pub struct Node<T, C = DefaultStorage>{
pub prefixes: Array256<Vec<T>>,
pub children: Array256<Vec<Child<C::Container<Self>, T>>>,
}Expand description
A trie node logically covering a single (octet) address stride.
Contains prefixes (directly owned by this node) and children (descendants in the trie).
This is the canonical stride-level Node type for the crate, mirroring
go-bart’s Full nodes. The operations its supports are abstracted for
via the StrideOps trait – other implementations are possible, e.g. to
support similar functionality to go-bart’s Lite and Fast node types.
Fields§
§prefixes: Array256<Vec<T>>The prefixes this node covers directly, indexed by BaseIndex.
If this node is at trie depth 3 via octet path [192, 168] for
instance, the prefix entry 12/5 => 34 would represent the overall
trie route mapping 192.168.12.0/21 => 34.
children: Array256<Vec<Child<C::Container<Self>, T>>>The children contained in this node, indexed by complete prefix octet.
Implementations§
Source§impl<T, C> Node<T, C>
impl<T, C> Node<T, C>
Trait Implementations§
impl<T: Eq, C> Eq for Node<T, C>
Source§impl<T: PartialEq, C> PartialEq for Node<T, C>
impl<T: PartialEq, C> PartialEq for Node<T, C>
Source§impl<T, C> PrefixOps for Node<T, C>
impl<T, C> PrefixOps for Node<T, C>
Source§impl<T, C> PrefixReadOps for Node<T, C>
impl<T, C> PrefixReadOps for Node<T, C>
Source§fn prefix_bitset(&self) -> &Bitset256
fn prefix_bitset(&self) -> &Bitset256
Get a reference to the prefix bitset.
Source§fn prefix_count(&self) -> usize
fn prefix_count(&self) -> usize
Get the number of prefixes in this node.
Source§impl<T, C> StrideBase for Node<T, C>
impl<T, C> StrideBase for Node<T, C>
Source§impl<T, C> StrideOps for Node<T, C>
impl<T, C> StrideOps for Node<T, C>
Source§fn child_bitset(&self) -> &Bitset256
fn child_bitset(&self) -> &Bitset256
Get a reference to the child bitset.
Source§fn child_count(&self) -> usize
fn child_count(&self) -> usize
Get the number of direct children of this node.
Source§fn insert_child(
&mut self,
addr: u8,
child: Child<Self, Self::T>,
) -> Option<Child<Self, Self::T>>
fn insert_child( &mut self, addr: u8, child: Child<Self, Self::T>, ) -> Option<Child<Self, Self::T>>
Insert a child node at the given address.
Source§fn direct_children(&self) -> impl Iterator<Item = (u8, Child<&Self, &T>)>
fn direct_children(&self) -> impl Iterator<Item = (u8, Child<&Self, &T>)>
Iterate the direct children of this node.
Source§fn remove_child(&mut self, addr: u8) -> Option<Child<Self, Self::T>>
fn remove_child(&mut self, addr: u8) -> Option<Child<Self, Self::T>>
Remove a child node at the given address.
impl<T, C> StructuralPartialEq for Node<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for Node<T, C>where
C: ?Sized,
impl<T, C> RefUnwindSafe for Node<T, C>
impl<T, C> Send for Node<T, C>
impl<T, C> Sync for Node<T, C>
impl<T, C> Unpin for Node<T, C>
impl<T, C> UnsafeUnpin for Node<T, C>where
C: ?Sized,
impl<T, C> UnwindSafe for Node<T, C>
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<T> PrefixOpsExt for T
impl<T> PrefixOpsExt for T
Source§fn supersets_prefix(&self, idx: BaseIndex) -> bool
fn supersets_prefix(&self, idx: BaseIndex) -> bool
Report whether this node’s prefix set covers the prefix with the given
index. It does not need to match exactly,
idx just needs to be
contained in this node’s prefix set. Read moreSource§impl<T> StrideOpsExt for Twhere
T: StrideOps,
impl<T> StrideOpsExt for Twhere
T: StrideOps,
Source§fn with_child(self, addr: u8, child: impl Into<Child<Self, Self::T>>) -> Self
fn with_child(self, addr: u8, child: impl Into<Child<Self, Self::T>>) -> Self
Return this node with the given child added. Read more
Source§fn into_child(self) -> Child<Self, Self::T>
fn into_child(self) -> Child<Self, Self::T>
Wrap this node in a
Child::Path.