pub struct ExtensionNode {
pub prefix: Nibbles,
pub child: NodeRef,
}Expand description
Extension Node of an an Ethereum Compatible Patricia Merkle Trie Contains the node’s prefix and a its child node hash, doesn’t store any value
Fields§
§prefix: Nibbles§child: NodeRefImplementations§
Source§impl ExtensionNode
impl ExtensionNode
Sourcepub const fn new(prefix: Nibbles, child: NodeRef) -> Self
pub const fn new(prefix: Nibbles, child: NodeRef) -> Self
Creates a new extension node given its child hash and prefix
Sourcepub fn get(
&self,
db: &dyn TrieDB,
path: Nibbles,
) -> Result<Option<ValueRLP>, TrieError>
pub fn get( &self, db: &dyn TrieDB, path: Nibbles, ) -> Result<Option<ValueRLP>, TrieError>
Retrieves a value from the subtrie originating from this node given its path
Sourcepub fn insert(
&mut self,
db: &dyn TrieDB,
path: Nibbles,
value: ValueOrHash,
) -> Result<Option<Node>, TrieError>
pub fn insert( &mut self, db: &dyn TrieDB, path: Nibbles, value: ValueOrHash, ) -> Result<Option<Node>, TrieError>
Inserts a value into the subtrie originating from this node and returns the new root of the subtrie.
If the new root happens to be self (potentially mutated), returns None. Otherwise, returns Some(node).
pub fn remove( &mut self, db: &dyn TrieDB, path: Nibbles, ) -> Result<(Option<NodeRemoveResult>, Option<ValueRLP>), TrieError>
Sourcepub fn compute_hash(&self, crypto: &dyn Crypto) -> NodeHash
pub fn compute_hash(&self, crypto: &dyn Crypto) -> NodeHash
Computes the node’s hash
Sourcepub fn compute_hash_no_alloc(
&self,
buf: &mut Vec<u8>,
crypto: &dyn Crypto,
) -> NodeHash
pub fn compute_hash_no_alloc( &self, buf: &mut Vec<u8>, crypto: &dyn Crypto, ) -> NodeHash
Computes the node’s hash, using the provided buffer
Sourcepub fn get_path(
&self,
db: &dyn TrieDB,
path: Nibbles,
node_path: &mut Vec<Vec<u8>>,
) -> Result<(), TrieError>
pub fn get_path( &self, db: &dyn TrieDB, path: Nibbles, node_path: &mut Vec<Vec<u8>>, ) -> Result<(), TrieError>
Traverses own subtrie until reaching the node containing path
Appends all encoded nodes traversed to node_path (including self)
Only nodes with encoded len over or equal to 32 bytes are included
Trait Implementations§
Source§impl Archive for ExtensionNode
impl Archive for ExtensionNode
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§impl Clone for ExtensionNode
impl Clone for ExtensionNode
Source§fn clone(&self) -> ExtensionNode
fn clone(&self) -> ExtensionNode
1.0.0 (const: unstable) · 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<'de> Deserialize<'de> for ExtensionNode
impl<'de> Deserialize<'de> for ExtensionNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<__D: Fallible + ?Sized> Deserialize<ExtensionNode, __D> for Archived<ExtensionNode>
impl<__D: Fallible + ?Sized> Deserialize<ExtensionNode, __D> for Archived<ExtensionNode>
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<ExtensionNode, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<ExtensionNode, <__D as Fallible>::Error>
Source§impl From<ExtensionNode> for Node
impl From<ExtensionNode> for Node
Source§fn from(val: ExtensionNode) -> Self
fn from(val: ExtensionNode) -> Self
Source§impl PartialEq for ExtensionNode
impl PartialEq for ExtensionNode
Source§fn eq(&self, other: &ExtensionNode) -> bool
fn eq(&self, other: &ExtensionNode) -> bool
self and other values to be equal, and is used by ==.Source§impl RLPEncode for ExtensionNode
impl RLPEncode for ExtensionNode
Source§impl Serialize for ExtensionNode
impl Serialize 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 UnsafeUnpin for ExtensionNode
impl UnwindSafe for ExtensionNode
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.