pub struct NibbleVec { /* private fields */ }
Expand description
Owning, nibble-oriented byte vector. Counterpart to NibbleSlice
.
Nibbles are always left aligned, so making a NibbleVec
from
a NibbleSlice
can get costy.
Implementations§
source§impl NibbleVec
impl NibbleVec
sourcepub fn drop_lasts(&mut self, n: usize)
pub fn drop_lasts(&mut self, n: usize)
Remove then n last nibbles in a faster way than popping n times.
sourcepub fn append(&mut self, v: &NibbleVec)
pub fn append(&mut self, v: &NibbleVec)
Append another NibbleVec
. Can be slow (alignement of second vec).
sourcepub fn append_partial(&mut self, (start_byte, sl): Partial<'_>)
pub fn append_partial(&mut self, (start_byte, sl): Partial<'_>)
Append a Partial
. Can be slow (alignement of partial).
sourcepub fn as_nibbleslice(&self) -> Option<NibbleSlice<'_>>
pub fn as_nibbleslice(&self) -> Option<NibbleSlice<'_>>
Try to treat this NibbleVec
as a NibbleSlice
. Works only if there is no padding.
sourcepub fn starts_with(&self, other: &Self) -> bool
pub fn starts_with(&self, other: &Self) -> bool
Do we start with the same nibbles as the whole of them
?
sourcepub fn right_iter<'a>(&'a self) -> impl Iterator<Item = u8> + 'a
pub fn right_iter<'a>(&'a self) -> impl Iterator<Item = u8> + 'a
Return an iterator over Partial
bytes representation.
Trait Implementations§
source§impl<'a> From<NibbleSlice<'a>> for NibbleVec
impl<'a> From<NibbleSlice<'a>> for NibbleVec
source§fn from(s: NibbleSlice<'a>) -> Self
fn from(s: NibbleSlice<'a>) -> Self
Converts to this type from the input type.