[][src]Trait nitric_component::id::SparseLinear

pub trait SparseLinear: Id<Key = usize> {
    type BitSet: BitSet;
    fn as_usize(&self) -> usize { ... }

An ID that can be used for sparse storages and behaves somewhat linear, meaning it starts at zero and does not use higher numbers than necessary.

Associated Key

SparseLinear requires a usize key which is expected to be linear; if this returns random / very big / very sparse numbers it will cause the storage to grow a lot!

In short: it is expected to be produced by some sort of counter starting at zero.

Associated Types

This is the bit set type that can be used by the storage. A storage which maps this ID type stores a field of type Self::BitSet, which will be used to check if a component exists for a particular ID.

Provided Methods

Convenience method for retrieving the usize key of this ID. This does not guarantee validity and is equivalent to as_key_unchecked.


impl SparseLinear for FlatUsize

impl<T> SparseLinear for T where
    T: Id<Key = usize> + WrapperId,
    T::Original: SparseLinear