Struct trie_db::NibbleVec [−][src]
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]
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]ⓘ[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<'a> From<NibbleSlice<'a>> for NibbleVec[src]
impl<'a> From<NibbleSlice<'a>> for NibbleVec[src]