pub trait TrieIndex:
Copy
+ Clone
+ Default
+ PartialEq
+ Eq
+ Debug
+ 'static {
// Required methods
fn as_usize(self) -> usize;
fn max_value() -> usize;
fn zero() -> Self;
fn max_value_sentinel() -> Self;
fn from_usize(n: usize) -> Self;
fn children_mask(children: &[Self; 16]) -> u16;
}Expand description
Trait for types used as arena/key indices and prefix lengths in NibbleTrie.
Implemented for u8, u16, u32, and u64. The type parameter PTR (pointer
type) controls the width of children, leaf, and arena indices. The type
parameter LEN (length type) controls the width of prefix_len and key
lengths in the index.
Required Methods§
Sourcefn max_value_sentinel() -> Self
fn max_value_sentinel() -> Self
Maximum value used as sentinel for empty slots in children[] by the
sibling tries (fixed_len_nibble_trie, nib_trie). nibble_trie
itself uses 0 as its sentinel (see OptNz), but keeps this method so
the trait stays shared.
Sourcefn from_usize(n: usize) -> Self
fn from_usize(n: usize) -> Self
Convert from usize. May panic or truncate on overflow in debug builds.
Sourcefn children_mask(children: &[Self; 16]) -> u16
fn children_mask(children: &[Self; 16]) -> u16
Compute a 16-bit occupancy mask from a 16-slot children array.
Bit N is set if children[N] is not zero.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".