pub struct PathComponent(pub U4);Expand description
A path component in a hexary trie; which is only 4 bits (aka a nibble).
Tuple Fields§
§0: U4Implementations§
Source§impl PathComponent
impl PathComponent
Sourcepub const ALL: [Self; 16]
pub const ALL: [Self; 16]
All possible path components.
This makes it easy to iterate over all possible children of a branch in a type-safe way. It is preferrable to do:
ⓘ
for (idx, slot) in PathComponent::ALL.into_iter().zip(branch.children.each_ref()) {
/// use idx and slot
}instead of using a raw range like (0..16) or Iterator::enumerate,
which does not give a type-safe path component.
Source§impl PathComponent
impl PathComponent
Sourcepub const fn new_pair(v: u8) -> (Self, Self)
pub const fn new_pair(v: u8) -> (Self, Self)
Creates a pair of path components from a single byte where the upper 4 bits are the first component and the lower 4 bits are the second component.
Sourcepub const fn join(self, other: Self) -> u8
pub const fn join(self, other: Self) -> u8
Joins this PathComponent with another to create a single u8 where
this component is the upper 4 bits and the provided component is the
lower 4 bits.
Trait Implementations§
Source§impl Binary for PathComponent
impl Binary for PathComponent
Source§impl Clone for PathComponent
impl Clone for PathComponent
Source§fn clone(&self) -> PathComponent
fn clone(&self) -> PathComponent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PathComponent
impl Debug for PathComponent
Source§impl Display for PathComponent
impl Display for PathComponent
Source§impl Extend<PathComponent> for PathGuard<'_>
impl Extend<PathComponent> for PathGuard<'_>
Source§fn extend<T: IntoIterator<Item = PathComponent>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = PathComponent>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Hash for PathComponent
impl Hash for PathComponent
Source§impl<T> Index<PathComponent> for Children<T>
impl<T> Index<PathComponent> for Children<T>
Source§impl<T> IndexMut<PathComponent> for Children<T>
impl<T> IndexMut<PathComponent> for Children<T>
Source§impl LowerHex for PathComponent
impl LowerHex for PathComponent
Source§impl Ord for PathComponent
impl Ord for PathComponent
Source§fn cmp(&self, other: &PathComponent) -> Ordering
fn cmp(&self, other: &PathComponent) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PathComponent
impl PartialEq for PathComponent
Source§impl PartialOrd for PathComponent
impl PartialOrd for PathComponent
Source§impl TriePath for PathComponent
impl TriePath for PathComponent
Source§type Components<'a> = IntoIter<PathComponent>
where
Self: 'a
type Components<'a> = IntoIter<PathComponent> where Self: 'a
The iterator returned by
TriePath::components.Source§fn components(&self) -> Self::Components<'_>
fn components(&self) -> Self::Components<'_>
Returns an iterator over the components of this path.
Source§fn as_component_slice(&self) -> PartialPath<'_>
fn as_component_slice(&self) -> PartialPath<'_>
Returns a contiguous view of this path’s components. Read more
Source§fn append<S>(self, suffix: S) -> JoinedPath<Self, S>
fn append<S>(self, suffix: S) -> JoinedPath<Self, S>
Appends the provided path segment to this path, returning a new joined
path that represents the concatenation of the two paths. Read more
Source§fn prepend<P>(self, prefix: P) -> JoinedPath<P, Self>
fn prepend<P>(self, prefix: P) -> JoinedPath<P, Self>
Prepends the provided path segment to this path, returning a new joined
path that represents the concatenation of the two paths. Read more
Source§fn path_eq<T: TriePath + ?Sized>(&self, other: &T) -> bool
fn path_eq<T: TriePath + ?Sized>(&self, other: &T) -> bool
Compares this path against another path for equality using path component
equality. Read more
Source§fn path_cmp<T: TriePath + ?Sized>(&self, other: &T) -> Ordering
fn path_cmp<T: TriePath + ?Sized>(&self, other: &T) -> Ordering
Compares this path against another path using path-component lexicographic
ordering. Strict prefixes are less than their longer counterparts. Read more
Source§fn display(&self) -> DisplayPath<'_, Self>
fn display(&self) -> DisplayPath<'_, Self>
Returns a wrapper type that implements
std::fmt::Display and
std::fmt::Debug for this path.Source§impl UpperHex for PathComponent
impl UpperHex for PathComponent
impl Copy for PathComponent
impl Eq for PathComponent
impl StructuralPartialEq for PathComponent
Auto Trait Implementations§
impl Freeze for PathComponent
impl RefUnwindSafe for PathComponent
impl Send for PathComponent
impl Sync for PathComponent
impl Unpin for PathComponent
impl UnsafeUnpin for PathComponent
impl UnwindSafe for PathComponent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> TriePathAsPackedBytes for T
impl<T> TriePathAsPackedBytes for T
Source§type PackedBytesIter<'a> = PackedBytes<<T as TriePath>::Components<'a>>
where
T: 'a
type PackedBytesIter<'a> = PackedBytes<<T as TriePath>::Components<'a>> where T: 'a
The iterator type returned by
TriePathAsPackedBytes::as_packed_bytes.Source§fn as_packed_bytes(&self) -> <T as TriePathAsPackedBytes>::PackedBytesIter<'_>
fn as_packed_bytes(&self) -> <T as TriePathAsPackedBytes>::PackedBytesIter<'_>
Returns an iterator over the packed bytes of this path. Read more
Source§impl<T> ValueSize for T
impl<T> ValueSize for T
Source§fn value_size(&self) -> usize
fn value_size(&self) -> usize
The size of this value in bytes, excluding allocated data. Read more
Source§fn value_size_sum_iter<'item>(iterator: impl Iterator<Item = &'item T>) -> usizewhere
T: 'item,
fn value_size_sum_iter<'item>(iterator: impl Iterator<Item = &'item T>) -> usizewhere
T: 'item,
The total sum of the sizes of all values in the given iterator, in
bytes. This is default-implemented by computing ValueSize::value_size
on every element and summing them. For Sized types, a more potentially
efficient implementation using Iterator::count is provided. If you are
implementing this trait manually, it is unlikely to be more efficient to
provide a manual implementation here. Read more
Source§fn value_size_sum_exact_size_iter<'item>(
iterator: impl ExactSizeIterator<Item = &'item T>,
) -> usizewhere
T: 'item,
fn value_size_sum_exact_size_iter<'item>(
iterator: impl ExactSizeIterator<Item = &'item T>,
) -> usizewhere
T: 'item,
The total sum of the sizes of all values in the given
exact-size-iterator, in bytes. This is default-implemented by using
ValueSize::value_size_sum_iter. For Sized types, a usually more
efficient implementation using ExactSizeIterator::len is provided. If
you are implementing this trait manually, it is unlikely to be more
efficient to provide a manual implementation here. Read more