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: Nibbles
The key for this extension node.
child: RlpNode
A 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 moreSource§impl Debug for ExtensionNode
impl Debug for ExtensionNode
Source§impl Decodable for ExtensionNode
impl Decodable for ExtensionNode
Source§impl Encodable for ExtensionNode
impl Encodable for ExtensionNode
Source§impl PartialEq for ExtensionNode
impl PartialEq for ExtensionNode
impl Eq for ExtensionNode
impl StructuralPartialEq for ExtensionNode
Auto Trait Implementations§
impl Freeze for ExtensionNode
impl RefUnwindSafe for ExtensionNode
impl Send for ExtensionNode
impl Sync for ExtensionNode
impl Unpin for ExtensionNode
impl UnwindSafe for ExtensionNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key
and return true
if they are equal.