Struct BranchNodeRef
pub struct BranchNodeRef<'a> {
pub stack: &'a [RlpNode],
pub state_mask: TrieMask,
}Expand description
Re-export A reference to BranchNode and its state mask. NOTE: The stack may contain more items that specified in the state mask.
Fields§
§stack: &'a [RlpNode]Reference to the collection of RLP encoded nodes. NOTE: The referenced stack might have more items than the number of children for this node. We should only ever access items starting from BranchNodeRef::first_child_index.
state_mask: TrieMaskReference to bitmask indicating the presence of children at the respective nibble positions.
Implementations§
§impl<'a> BranchNodeRef<'a>
impl<'a> BranchNodeRef<'a>
pub const fn new(
stack: &'a [RlpNode],
state_mask: TrieMask,
) -> BranchNodeRef<'a>
pub const fn new( stack: &'a [RlpNode], state_mask: TrieMask, ) -> BranchNodeRef<'a>
Create a new branch node from the stack of nodes.
pub fn first_child_index(&self) -> usize
pub fn first_child_index(&self) -> usize
Returns the stack index of the first child for this node.
§Panics
If the stack length is less than number of children specified in state mask. Means that the node is in inconsistent state.
pub fn children(&self) -> impl Iterator<Item = (u8, Option<&RlpNode>)>
pub fn children(&self) -> impl Iterator<Item = (u8, Option<&RlpNode>)>
Returns an iterator over children of the branch node.
pub fn child_hashes(
&self,
hash_mask: TrieMask,
) -> impl Iterator<Item = FixedBytes<32>>
pub fn child_hashes( &self, hash_mask: TrieMask, ) -> impl Iterator<Item = FixedBytes<32>>
Given the hash mask of children, return an iterator over stack items that match the mask.
Trait Implementations§
§impl<'a> Clone for BranchNodeRef<'a>
impl<'a> Clone for BranchNodeRef<'a>
§fn clone(&self) -> BranchNodeRef<'a>
fn clone(&self) -> BranchNodeRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for BranchNodeRef<'_>
impl Debug for BranchNodeRef<'_>
§impl Encodable for BranchNodeRef<'_>
Implementation of RLP encoding for branch node in Ethereum Merkle Patricia Trie.
Encode it as a 17-element list consisting of 16 slots that correspond to
each child of the node (0-f) and an additional slot for a value.
impl Encodable for BranchNodeRef<'_>
Implementation of RLP encoding for branch node in Ethereum Merkle Patricia Trie. Encode it as a 17-element list consisting of 16 slots that correspond to each child of the node (0-f) and an additional slot for a value.
Auto Trait Implementations§
impl<'a> Freeze for BranchNodeRef<'a>
impl<'a> RefUnwindSafe for BranchNodeRef<'a>
impl<'a> Send for BranchNodeRef<'a>
impl<'a> Sync for BranchNodeRef<'a>
impl<'a> Unpin for BranchNodeRef<'a>
impl<'a> UnsafeUnpin for BranchNodeRef<'a>
impl<'a> UnwindSafe for BranchNodeRef<'a>
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<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> 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> MaybeDebug for Twhere
T: Debug,
§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> ⓘ
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: 24 bytes