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 starts_with_slice(&self, other: &NibbleSlice<'_>) -> bool
pub fn starts_with_slice(&self, other: &NibbleSlice<'_>) -> bool
Same as Self::starts_with
but using NibbleSlice
.
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.
source§impl<'a> PartialEq<NibbleVec> for NibbleSlice<'a>
impl<'a> PartialEq<NibbleVec> for NibbleSlice<'a>
source§impl PartialEq<NibbleVec> for NibbleVec
impl PartialEq<NibbleVec> for NibbleVec
impl Eq for NibbleVec
impl StructuralEq for NibbleVec
impl StructuralPartialEq for NibbleVec
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more