pub struct CursorSubNode {
pub key: Nibbles,
pub node: Option<BranchNodeCompact>,
/* private fields */
}Expand description
Cursor for iterating over a subtrie.
Fields§
§key: NibblesThe key of the current node.
node: Option<BranchNodeCompact>The node itself.
Implementations§
Source§impl CursorSubNode
impl CursorSubNode
Sourcepub fn new(key: Nibbles, node: Option<BranchNodeCompact>) -> Self
pub fn new(key: Nibbles, node: Option<BranchNodeCompact>) -> Self
Creates a new CursorSubNode from a key and an optional node.
Sourcepub fn full_key_is_only_nonremoved_child(
&self,
added_removed_keys: &AddedRemovedKeys,
) -> bool
pub fn full_key_is_only_nonremoved_child( &self, added_removed_keys: &AddedRemovedKeys, ) -> bool
Returns true if all of:
- Position is a child
- There is a branch node
- All children except the current are removed according to the [
AddedRemovedKeys].
Sourcepub fn state_flag(&self) -> bool
pub fn state_flag(&self) -> bool
Returns true if either of these:
- No current node is set.
- The current node is a parent branch node.
- The current node is a child with state mask bit set in the parent branch node.
Sourcepub fn tree_flag(&self) -> bool
pub fn tree_flag(&self) -> bool
Returns true if either of these:
- No current node is set.
- The current node is a parent branch node.
- The current node is a child with tree mask bit set in the parent branch node.
Sourcepub fn hash_flag(&self) -> bool
pub fn hash_flag(&self) -> bool
Returns true if the hash for the current node is set.
It means either of two:
- Current node is a parent branch node, and it has a root hash.
- Current node is a child node, and it has a hash mask bit set in the parent branch node.
Sourcepub fn hash(&self) -> Option<B256>
pub fn hash(&self) -> Option<B256>
Returns the hash of the current node.
It means either of two:
- Root hash of the parent branch node.
- Hash of the child node at the current nibble, if it has a hash mask bit set in the parent branch node.
Sourcepub fn maybe_hash(&self) -> Option<B256>
pub fn maybe_hash(&self) -> Option<B256>
Returns the hash of the current node, if any.
Differs from Self::hash in that it returns None if the subnode is positioned at the
child without a hash mask bit set. Self::hash panics in that case.
Sourcepub const fn position(&self) -> SubNodePosition
pub const fn position(&self) -> SubNodePosition
Returns the position to the current node.
Sourcepub fn inc_nibble(&mut self)
pub fn inc_nibble(&mut self)
Increments the nibble index.
Sourcepub fn set_nibble(&mut self, nibble: u8)
pub fn set_nibble(&mut self, nibble: u8)
Sets the nibble index.
Trait Implementations§
Source§impl Clone for CursorSubNode
impl Clone for CursorSubNode
Source§impl Debug for CursorSubNode
impl Debug for CursorSubNode
Source§impl Default for CursorSubNode
impl Default for CursorSubNode
Source§impl From<CursorSubNode> for StoredSubNode
impl From<CursorSubNode> for StoredSubNode
Source§fn from(value: CursorSubNode) -> Self
fn from(value: CursorSubNode) -> Self
Source§impl From<StoredSubNode> for CursorSubNode
Implements conversion from StoredSubNode to CursorSubNode.
impl From<StoredSubNode> for CursorSubNode
Implements conversion from StoredSubNode to CursorSubNode.
Source§fn from(value: StoredSubNode) -> Self
fn from(value: StoredSubNode) -> Self
Converts a StoredSubNode into a CursorSubNode.
Extracts necessary values from the StoredSubNode and constructs
a corresponding CursorSubNode.
Auto Trait Implementations§
impl Freeze for CursorSubNode
impl RefUnwindSafe for CursorSubNode
impl Send for CursorSubNode
impl Sync for CursorSubNode
impl Unpin for CursorSubNode
impl UnsafeUnpin for CursorSubNode
impl UnwindSafe for CursorSubNode
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§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>,
Source§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: 136 bytes