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<'de> Deserialize<'de> for TrieMask
impl<'de> Deserialize<'de> for TrieMask
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.