Module smallmap::primitive

source ·
Expand description

Contains Collapse impls for primitive types through a newtype shim.

Why

Such wrappers are a workaround for the lack of template specialisation available in Rust so far, as the generic impl<T: Hash> Collapse<T> for T still requires computing the hash of the internal types before reducing to the u8 page index. For primitive types, this is unnessisary and causes a (very slight) performance loss.

If/when Rust gets specialisation, this will be unneeded.

Structs

  • Shim for primitive types to efficiently implement Collapse.

Traits

  • Sealed trait allowing for wrapping primitive types with a more efficient implemntation for the Collapse trait. This should not be used for much directly, instead use the newtype shim Primitive<T>.