pub struct BranchNodeRef<'a> {
pub stack: &'a [RlpNode],
pub state_mask: TrieMask,
}
Expand description
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: TrieMask
Reference to bitmask indicating the presence of children at the respective nibble positions.
Implementations§
Source§impl<'a> BranchNodeRef<'a>
impl<'a> BranchNodeRef<'a>
Sourcepub const fn new(stack: &'a [RlpNode], state_mask: TrieMask) -> Self
pub const fn new(stack: &'a [RlpNode], state_mask: TrieMask) -> Self
Create a new branch node from the stack of nodes.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn child_hashes(
&self,
hash_mask: TrieMask,
) -> impl Iterator<Item = B256> + '_
pub fn child_hashes( &self, hash_mask: TrieMask, ) -> impl Iterator<Item = B256> + '_
Given the hash mask of children, return an iterator over stack items that match the mask.
Trait Implementations§
Source§impl<'a> Clone for BranchNodeRef<'a>
impl<'a> Clone for BranchNodeRef<'a>
Source§fn clone(&self) -> BranchNodeRef<'a>
fn clone(&self) -> BranchNodeRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BranchNodeRef<'_>
impl Debug for BranchNodeRef<'_>
Source§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.