Struct trie_db::NibbleVec [−][src]
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]
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 Clone for NibbleVec
[src]
impl Debug for NibbleVec
[src]
impl Default for NibbleVec
[src]
impl Eq for NibbleVec
[src]
impl<'a> From<NibbleSlice<'a>> for NibbleVec
[src]
fn from(s: NibbleSlice<'a>) -> Self
[src]
impl PartialEq<NibbleVec> for NibbleVec
[src]
impl StructuralEq for NibbleVec
[src]
impl StructuralPartialEq for NibbleVec
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,