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
?
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
Performs the conversion.
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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more