Struct diem_sdk::types::nibble::nibble_path::NibblePath
pub struct NibblePath { /* private fields */ }
Expand description
NibblePath defines a path in Merkle tree in the unit of nibble (4 bits).
Implementations§
§impl NibblePath
impl NibblePath
pub fn new(bytes: Vec<u8, Global>) -> NibblePath
pub fn new(bytes: Vec<u8, Global>) -> NibblePath
Creates a new NibblePath
from a vector of bytes assuming each byte has 2 nibbles.
pub fn new_odd(bytes: Vec<u8, Global>) -> NibblePath
pub fn new_odd(bytes: Vec<u8, Global>) -> NibblePath
Similar to new()
but assumes that the bytes have one less nibble.
pub fn get_nibble(&self, i: usize) -> Nibble
pub fn get_nibble(&self, i: usize) -> Nibble
Get the i-th nibble.
pub fn bits(&self) -> BitIterator<'_> ⓘ
pub fn bits(&self) -> BitIterator<'_> ⓘ
Get a bit iterator iterates over the whole nibble path.
pub fn nibbles(&self) -> NibbleIterator<'_> ⓘ
pub fn nibbles(&self) -> NibbleIterator<'_> ⓘ
Get a nibble iterator iterates over the whole nibble path.
pub fn num_nibbles(&self) -> usize
pub fn num_nibbles(&self) -> usize
Get the total number of nibbles stored.
Trait Implementations§
§impl Arbitrary for NibblePath
impl Arbitrary for NibblePath
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§fn arbitrary_with(
_args: <NibblePath as Arbitrary>::Parameters
) -> <NibblePath as Arbitrary>::Strategy
fn arbitrary_with( _args: <NibblePath as Arbitrary>::Parameters ) -> <NibblePath as Arbitrary>::Strategy
§type Strategy = BoxedStrategy<NibblePath>
type Strategy = BoxedStrategy<NibblePath>
The type of
Strategy
used to generate values of type Self
.§impl Clone for NibblePath
impl Clone for NibblePath
§fn clone(&self) -> NibblePath
fn clone(&self) -> NibblePath
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl 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”.
§impl<'de> Deserialize<'de> for NibblePath
impl<'de> Deserialize<'de> for NibblePath
§fn deserialize<__D>(
__deserializer: __D
) -> Result<NibblePath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<NibblePath, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl 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.
§fn from_iter<I>(iter: I) -> NibblePathwhere
I: IntoIterator<Item = Nibble>,
fn from_iter<I>(iter: I) -> NibblePathwhere I: IntoIterator<Item = Nibble>,
Creates a value from an iterator. Read more
§impl Hash for NibblePath
impl Hash for NibblePath
§impl Ord for NibblePath
impl Ord for NibblePath
§impl PartialEq<NibblePath> for NibblePath
impl PartialEq<NibblePath> for NibblePath
§fn 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 ==
.§impl PartialOrd<NibblePath> for NibblePath
impl PartialOrd<NibblePath> for NibblePath
§fn partial_cmp(&self, other: &NibblePath) -> Option<Ordering>
fn partial_cmp(&self, other: &NibblePath) -> Option<Ordering>
1.0.0 · source§fn 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§impl Serialize for NibblePath
impl Serialize for NibblePath
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
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§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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>
§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.