pub struct TrieMask(/* private fields */);Expand description
A struct representing a mask of 16 bits, used for Ethereum trie operations.
Masks in a trie are used to efficiently represent and manage information about the presence or absence of certain elements, such as child nodes, within a trie. Masks are usually implemented as bit vectors, where each bit represents the presence (1) or absence (0) of a corresponding element.
Implementations§
Source§impl TrieMask
impl TrieMask
Sourcepub const fn from_nibble(nibble: u8) -> Self
pub const fn from_nibble(nibble: u8) -> Self
Creates a new TrieMask from the given nibble.
Sourcepub fn is_subset_of(self, other: Self) -> bool
pub fn is_subset_of(self, other: Self) -> bool
Returns true if the current TrieMask is a subset of other.
Sourcepub const fn is_bit_set(self, index: u8) -> bool
pub const fn is_bit_set(self, index: u8) -> bool
Returns true if a given bit is set in a mask.
Sourcepub const fn count_bits(self) -> u8
pub const fn count_bits(self) -> u8
Returns the number of bits set in the mask.
Sourcepub const fn first_set_bit_index(self) -> Option<u8>
pub const fn first_set_bit_index(self) -> Option<u8>
Returns the index of the first bit set in the mask, or None if the mask is empty.
Trait Implementations§
Source§impl BitAndAssign for TrieMask
impl BitAndAssign for TrieMask
Source§fn bitand_assign(&mut self, rhs: TrieMask)
fn bitand_assign(&mut self, rhs: TrieMask)
Performs the
&= operation. Read moreSource§impl BitOrAssign for TrieMask
impl BitOrAssign for TrieMask
Source§fn bitor_assign(&mut self, rhs: TrieMask)
fn bitor_assign(&mut self, rhs: TrieMask)
Performs the
|= operation. Read moreSource§impl Ord for TrieMask
impl Ord for TrieMask
Source§impl PartialOrd for TrieMask
impl PartialOrd for TrieMask
impl Copy for TrieMask
impl Eq for TrieMask
impl StructuralPartialEq for TrieMask
Auto Trait Implementations§
impl Freeze for TrieMask
impl RefUnwindSafe for TrieMask
impl Send for TrieMask
impl Sync for TrieMask
impl Unpin for TrieMask
impl UnwindSafe for TrieMask
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