nook 0.1.0

Useful types with niches
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented4 out of 4 items with examples
  • Size
  • Source code size: 7.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.19 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tialaramex/nook
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tialaramex

Nook

Nook will become a collection of Rust types with niches

Niches

Rust types can have a "niche" which will be used during type layout to make containing types smaller than they'd otherwise need to be. For example&T is the same size as Option<&T>.

The Rust standard library includes std::num::NonZeroIsize and similar non-zero types with this property. Today we cannot add niches to our own types without nightly Rust features, and so that's what this crate does. But since the existence of niches is crucial to Rust's design, some day they'll be stabilized:

joshtriplett's Proposed RFC is the current effort towards stabilisation.

The intent is that Nook will grow to include other types which have two desirable properties: They make sense as types, and yet they also offer a niche

Types so far

nook::BalancedI8 nook::BalancedI16 nook::BalancedI32 nook::BalancedI64

Balanced integers are a pleasant and in some ways easier to use integral type lacking the most negative value from ordinary signed integers