pub struct ExtensionNode {
pub key: Nibbles,
pub child: RlpNode,
}Expand description
An extension node in an Ethereum Merkle Patricia Trie.
An intermediate node that exists solely to compress the trie’s paths. It contains a path segment (a shared prefix of keys) and a single child pointer. Essentially, an extension node can be thought of as a shortcut within the trie to reduce its overall depth.
The purpose of an extension node is to optimize the trie structure by collapsing multiple nodes with a single child into one node. This simplification reduces the space and computational complexity when performing operations on the trie.
Fields§
§key: NibblesThe key for this extension node.
child: RlpNodeA pointer to the child node.
Implementations§
Source§impl ExtensionNode
impl ExtensionNode
Sourcepub const EVEN_FLAG: u8 = 0u8
pub const EVEN_FLAG: u8 = 0u8
The flag representing the even number of nibbles in the extension key.
Sourcepub const ODD_FLAG: u8 = 16u8
pub const ODD_FLAG: u8 = 16u8
The flag representing the odd number of nibbles in the extension key.
Sourcepub const fn new(key: Nibbles, child: RlpNode) -> Self
pub const fn new(key: Nibbles, child: RlpNode) -> Self
Creates a new extension node with the given key and a pointer to the child.
Sourcepub fn as_ref(&self) -> ExtensionNodeRef<'_>
pub fn as_ref(&self) -> ExtensionNodeRef<'_>
Return extension node as ExtensionNodeRef.
Trait Implementations§
Source§impl Clone for ExtensionNode
impl Clone for ExtensionNode
Source§fn clone(&self) -> ExtensionNode
fn clone(&self) -> ExtensionNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more