[][src]Struct trie_db::NibbleVec

pub struct NibbleVec { /* fields omitted */ }

Owning, nibble-oriented byte vector. Counterpart to NibbleSlice. Nibbles are always left aligned, so making a NibbleVec from a NibbleSlice can get costy.

Implementations

impl NibbleVec[src]

pub fn new() -> Self[src]

Make a new NibbleVec.

pub fn len(&self) -> usize[src]

Length of the NibbleVec.

pub fn is_empty(&self) -> bool[src]

Retrurns true if NibbleVec has zero length.

pub fn at(&self, idx: usize) -> u8[src]

Try to get the nibble at the given offset.

pub fn push(&mut self, nibble: u8)[src]

Push a nibble onto the NibbleVec. Ignores the high 4 bits.

pub fn pop(&mut self) -> Option<u8>[src]

Try to pop a nibble off the NibbleVec. Fails if len == 0.

pub fn drop_lasts(&mut self, n: usize)[src]

Remove then n last nibbles in a faster way than popping n times.

pub fn as_prefix(&self) -> Prefix<'_>[src]

Get Prefix representation of this NibbleVec.

pub fn append(&mut self, v: &NibbleVec)[src]

Append another NibbleVec. Can be slow (alignement of second vec).

pub fn append_partial(&mut self, (start_byte, sl): Partial<'_>)[src]

Append a Partial. Can be slow (alignement of partial).

pub fn inner(&self) -> &[u8]

Notable traits for &'_ mut [u8]

impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
[src]

Get the underlying byte slice.

pub fn clear(&mut self)[src]

clear

pub fn as_nibbleslice(&self) -> Option<NibbleSlice<'_>>[src]

Try to treat this NibbleVec as a NibbleSlice. Works only if there is no padding.

pub fn starts_with(&self, other: &Self) -> bool[src]

Do we start with the same nibbles as the whole of them?

Trait Implementations

impl Clone for NibbleVec[src]

impl Debug for NibbleVec[src]

impl Default for NibbleVec[src]

impl Eq for NibbleVec[src]

impl<'a> From<NibbleSlice<'a>> for NibbleVec[src]

impl PartialEq<NibbleVec> for NibbleVec[src]

impl StructuralEq for NibbleVec[src]

impl StructuralPartialEq for NibbleVec[src]

Auto Trait Implementations

impl RefUnwindSafe for NibbleVec

impl Send for NibbleVec

impl Sync for NibbleVec

impl Unpin for NibbleVec

impl UnwindSafe for NibbleVec

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.