"smallnum" crate: compile-time size optimization for numeric primitives

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • smallnum

    Compile-time size optimization for numeric primitives.

  • Thus, this crate provides a macro to automatically determine the smallest integer type that can "fit" a constant max. When the size of a backing collection is known at compile-time (e.g. when using crates like `smallvec` for `!#[no_std]` development), this compile-time optimization can help save precious bytes - potentially for every node in an index-based structure (see README examples). Currently supports signed and unsigned numbers, but I’d love help with floating point support if anyone has ideas (though I don't know what a realistic usecase would be :P).

  • deranged

    Proof of concept ranged integers in Rust.

  • It looks like all these macros do is return a type and nothing else? Why can't this just be done by hand? I've done something similar for the macro for deranged, but that's for integers with a known and enforced range.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • rfcs

    RFCs for changes to Rust

  • Sweet, deranged reminds me of Range Types in the Ada programming language - very cool feature to add to Rust! This RFC might interest you.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts