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
sourceimpl 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 inner(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn inner(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Get the underlying byte slice.
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
sourceimpl<'a> From<NibbleSlice<'a>> for NibbleVec
impl<'a> From<NibbleSlice<'a>> for NibbleVec
sourcefn from(s: NibbleSlice<'a>) -> Self
fn from(s: NibbleSlice<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> PartialEq<NibbleVec> for NibbleSlice<'a>
impl<'a> PartialEq<NibbleVec> for NibbleSlice<'a>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more