Expand description
This crate provides the Finite
trait for use with types with a small number of values
(typically, but not exclusively enum
s). Deriving this trait enables several useful
applications:
Macros§
- impl_
concrete_ finite - Implements helper traits for a concrete (i.e. non-parameteric) type that implements
Finite
.
Structs§
- Array
Map - A complete mapping from keys of type
K
to values of typeV
, implemented using an array indexed byFinite::index_of
of the key. - Bitmap
Set - A set of values of type
T
, implemented using a bitmap. - Compress
- A compressed representation of a value of type
T
, implemented by storing its index accordingFinite::index_of
using the smallest integer type possible. - Finite
Iter - An iterator over all of the values of a
Finite
type.
Traits§
- Finite
- Provides the number of values for a type, as well as a 1-to-1 mapping between the subset of
integers [0 .. N) and those values. The ordering of integers in this mapping is homomorphic to
the ordering of values according to
Ord
(i.e.T::index_of(a) < T::index_of(b)
iffa < b
). - Set
- A set of values of type
T
.
Functions§
- compress
- Gets a compressed representation of the given value.