Struct BranchNodeCompact
pub struct BranchNodeCompact {
pub state_mask: TrieMask,
pub tree_mask: TrieMask,
pub hash_mask: TrieMask,
pub hashes: Arc<Vec<FixedBytes<32>>>,
pub root_hash: Option<FixedBytes<32>>,
}Expand description
Re-export A struct representing a branch node in an Ethereum trie.
A branch node can have up to 16 children, each corresponding to one of the possible nibble
values (0 to f) in the trie’s path.
The masks in a BranchNode are used to efficiently represent and manage information about the
presence and types of its children. They are bitmasks, where each bit corresponds to a nibble
(half-byte, or 4 bits) value from 0 to f.
Fields§
§state_mask: TrieMaskThe bitmask indicating the presence of children at the respective nibble positions in the trie. If the bit at position i (counting from the right) is set (1), it indicates that a child exists for the nibble value i. If the bit is unset (0), it means there is no child for that nibble value.
tree_mask: TrieMaskThe bitmask representing the children at the respective nibble positions in the trie that
are also stored in the database. If the bit at position i (counting from the right)
is set (1) and also present in the state_mask, it indicates that the corresponding
child at the nibble value i is stored in the database. If the bit is unset (0), it means
the child is not stored in the database.
hash_mask: TrieMaskThe bitmask representing the hashed branch children nodes at the respective nibble
positions in the trie. If the bit at position i (counting from the right) is set (1)
and also present in the state_mask, it indicates that the corresponding child at the
nibble value i is a hashed branch child node. If the bit is unset (0), it means the child
is not a hashed branch child node.
hashes: Arc<Vec<FixedBytes<32>>>Collection of hashes associated with the children of the branch node. Each child hash is calculated by hashing two consecutive sub-branch roots.
root_hash: Option<FixedBytes<32>>An optional root hash of the subtree rooted at this branch node.
Implementations§
§impl BranchNodeCompact
impl BranchNodeCompact
pub fn new(
state_mask: impl Into<TrieMask>,
tree_mask: impl Into<TrieMask>,
hash_mask: impl Into<TrieMask>,
hashes: Vec<FixedBytes<32>>,
root_hash: Option<FixedBytes<32>>,
) -> BranchNodeCompact
pub fn new( state_mask: impl Into<TrieMask>, tree_mask: impl Into<TrieMask>, hash_mask: impl Into<TrieMask>, hashes: Vec<FixedBytes<32>>, root_hash: Option<FixedBytes<32>>, ) -> BranchNodeCompact
Creates a new BranchNodeCompact from the given parameters.
pub fn hash_for_nibble(&self, nibble: u8) -> FixedBytes<32>
pub fn hash_for_nibble(&self, nibble: u8) -> FixedBytes<32>
Returns the hash associated with the given nibble.
Trait Implementations§
§impl Clone for BranchNodeCompact
impl Clone for BranchNodeCompact
§fn clone(&self) -> BranchNodeCompact
fn clone(&self) -> BranchNodeCompact
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Compact for BranchNodeCompact
impl Compact for BranchNodeCompact
§fn to_compact<B>(&self, buf: &mut B) -> usize
fn to_compact<B>(&self, buf: &mut B) -> usize
§fn from_compact(buf: &[u8], _len: usize) -> (BranchNodeCompact, &[u8])
fn from_compact(buf: &[u8], _len: usize) -> (BranchNodeCompact, &[u8])
buf with its internal cursor
advanced (eg..advance(len)). Read more§fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
§fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
§impl Compress for BranchNodeCompact
impl Compress for BranchNodeCompact
§type Compressed = Vec<u8>
type Compressed = Vec<u8>
§fn compress_to_buf<B>(&self, buf: &mut B)
fn compress_to_buf<B>(&self, buf: &mut B)
§fn uncompressable_ref(&self) -> Option<&[u8]>
fn uncompressable_ref(&self) -> Option<&[u8]>
Some(self.as_ref())§impl Debug for BranchNodeCompact
impl Debug for BranchNodeCompact
§impl Decompress for BranchNodeCompact
impl Decompress for BranchNodeCompact
§fn decompress(value: &[u8]) -> Result<BranchNodeCompact, DecompressError>
fn decompress(value: &[u8]) -> Result<BranchNodeCompact, DecompressError>
§fn decompress_owned(value: Vec<u8>) -> Result<Self, DecompressError>
fn decompress_owned(value: Vec<u8>) -> Result<Self, DecompressError>
§impl Default for BranchNodeCompact
impl Default for BranchNodeCompact
§fn default() -> BranchNodeCompact
fn default() -> BranchNodeCompact
§impl<'de> Deserialize<'de> for BranchNodeCompact
impl<'de> Deserialize<'de> for BranchNodeCompact
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BranchNodeCompact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BranchNodeCompact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for BranchNodeCompact
§impl Ord for BranchNodeCompact
impl Ord for BranchNodeCompact
§fn cmp(&self, other: &BranchNodeCompact) -> Ordering
fn cmp(&self, other: &BranchNodeCompact) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for BranchNodeCompact
impl PartialEq for BranchNodeCompact
§impl PartialOrd for BranchNodeCompact
impl PartialOrd for BranchNodeCompact
§impl Serialize for BranchNodeCompact
impl Serialize for BranchNodeCompact
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for BranchNodeCompact
Auto Trait Implementations§
impl Freeze for BranchNodeCompact
impl RefUnwindSafe for BranchNodeCompact
impl Send for BranchNodeCompact
impl Sync for BranchNodeCompact
impl Unpin for BranchNodeCompact
impl UnsafeUnpin for BranchNodeCompact
impl UnwindSafe for BranchNodeCompact
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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 moreimpl<T> MaybeCompact for Twhere
T: Compact,
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes