pub struct Stem(pub [u8; 31]);Expand description
A 31-byte stem that identifies a subtree of 256 values.
Tuple Fields§
§0: [u8; 31]Implementations§
Source§impl Stem
impl Stem
Sourcepub fn from_slice(slice: &[u8]) -> Self
pub fn from_slice(slice: &[u8]) -> Self
Create a stem from a slice. Panics if length != 31.
Sourcepub fn bit_at(&self, pos: usize) -> bool
pub fn bit_at(&self, pos: usize) -> bool
Get bit at position (0 = MSB of first byte, 247 = LSB of last byte). This is used for tree traversal.
Sourcepub fn first_differing_bit(&self, other: &Self) -> Option<usize>
pub fn first_differing_bit(&self, other: &Self) -> Option<usize>
Find the first bit position where two stems differ. Returns None if stems are equal.
Trait Implementations§
Source§impl Ord for Stem
impl Ord for Stem
Source§impl PartialOrd for Stem
impl PartialOrd for Stem
impl Copy for Stem
impl Eq for Stem
impl StructuralPartialEq for Stem
Auto Trait Implementations§
impl Freeze for Stem
impl RefUnwindSafe for Stem
impl Send for Stem
impl Sync for Stem
impl Unpin for Stem
impl UnsafeUnpin for Stem
impl UnwindSafe for Stem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more