Struct aptos_types::nibble::nibble_path::NibblePath
source · [−]pub struct NibblePath { /* private fields */ }Expand description
NibblePath defines a path in Merkle tree in the unit of nibble (4 bits).
Implementations
sourceimpl NibblePath
impl NibblePath
sourcepub fn new_even(bytes: Vec<u8>) -> Self
pub fn new_even(bytes: Vec<u8>) -> Self
Creates a new NibblePath from a vector of bytes assuming each byte has 2 nibbles.
sourcepub fn new_odd(bytes: Vec<u8>) -> Self
pub fn new_odd(bytes: Vec<u8>) -> Self
Similar to new() but assumes that the bytes have one less nibble.
pub fn new_from_state_key(state_key: &StateKey, num_nibbles: usize) -> Self
sourcepub fn get_nibble(&self, i: usize) -> Nibble
pub fn get_nibble(&self, i: usize) -> Nibble
Get the i-th nibble.
sourcepub fn bits(&self) -> BitIterator<'_>ⓘNotable traits for BitIterator<'a>impl<'a> Iterator for BitIterator<'a> type Item = bool;
pub fn bits(&self) -> BitIterator<'_>ⓘNotable traits for BitIterator<'a>impl<'a> Iterator for BitIterator<'a> type Item = bool;
Get a bit iterator iterates over the whole nibble path.
sourcepub fn nibbles(&self) -> NibbleIterator<'_>ⓘNotable traits for NibbleIterator<'a>impl<'a> Iterator for NibbleIterator<'a> type Item = Nibble;
pub fn nibbles(&self) -> NibbleIterator<'_>ⓘNotable traits for NibbleIterator<'a>impl<'a> Iterator for NibbleIterator<'a> type Item = Nibble;
Get a nibble iterator iterates over the whole nibble path.
sourcepub fn num_nibbles(&self) -> usize
pub fn num_nibbles(&self) -> usize
Get the total number of nibbles stored.
sourcepub fn bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Get the underlying bytes storing nibbles.
pub fn truncate(&mut self, len: usize)
Trait Implementations
sourceimpl Clone for NibblePath
impl Clone for NibblePath
sourcefn clone(&self) -> NibblePath
fn clone(&self) -> NibblePath
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for NibblePath
impl Debug for NibblePath
Supports debug format by concatenating nibbles literally. For example, [0x12, 0xa0] with 3 nibbles will be printed as “12a”.
sourceimpl<'de> Deserialize<'de> for NibblePath
impl<'de> Deserialize<'de> for NibblePath
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromIterator<Nibble> for NibblePath
impl FromIterator<Nibble> for NibblePath
Convert a vector of bytes into NibblePath using the lower 4 bits of each byte as nibble.
sourcefn from_iter<I: IntoIterator<Item = Nibble>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Nibble>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl Hash for NibblePath
impl Hash for NibblePath
sourceimpl Ord for NibblePath
impl Ord for NibblePath
sourceimpl PartialEq<NibblePath> for NibblePath
impl PartialEq<NibblePath> for NibblePath
sourcefn eq(&self, other: &NibblePath) -> bool
fn eq(&self, other: &NibblePath) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &NibblePath) -> bool
fn ne(&self, other: &NibblePath) -> bool
This method tests for !=.
sourceimpl PartialOrd<NibblePath> for NibblePath
impl PartialOrd<NibblePath> for NibblePath
sourcefn partial_cmp(&self, other: &NibblePath) -> Option<Ordering>
fn partial_cmp(&self, other: &NibblePath) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl Serialize for NibblePath
impl Serialize for NibblePath
impl Eq for NibblePath
impl StructuralEq for NibblePath
impl StructuralPartialEq for NibblePath
Auto Trait Implementations
impl RefUnwindSafe for NibblePath
impl Send for NibblePath
impl Sync for NibblePath
impl Unpin for NibblePath
impl UnwindSafe for NibblePath
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> TestOnlyHash for T where
T: Serialize + ?Sized,
impl<T> TestOnlyHash for T where
T: Serialize + ?Sized,
sourcefn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn 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>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more