pub enum Child<Node, T> {
Path(Node),
Leaf {
prefix: IpNet,
value: T,
},
Fringe(T),
}Expand description
Entries in a node’s children array.
Variants§
Path(Node)
Child containing another node.
Leaf
Path-compressed single descendant.
If a prefix would be inserted that spans multiple octet strides and there is no child for the starting octet, it is instead stored as a single leaf. This is the primary mechanism for path compression.
Fringe(T)
Fringe nodes store single /8s for this depth in the trie.
This can be seen as an optimization over Leaf
for cases where prefix lies on this depth’s /8 boundary.
Implementations§
Source§impl<Node, T> Child<Node, T>
impl<Node, T> Child<Node, T>
Sourcepub const fn as_mut(&mut self) -> Child<&mut Node, &mut T>
pub const fn as_mut(&mut self) -> Child<&mut Node, &mut T>
Convert this ref-mut-to-child into a child-of-ref-mut.
Sourcepub fn map_node<Nu>(self, f: impl FnOnce(Node) -> Nu) -> Child<Nu, T>
pub fn map_node<Nu>(self, f: impl FnOnce(Node) -> Nu) -> Child<Nu, T>
If this is a path node, apply f to the contained value.
Sourcepub fn into_value(self) -> Option<T>
pub fn into_value(self) -> Option<T>
Get the value directly contained in this node, if it’s a leaf or fringe.
Return None iff this is a Path.
Sourcepub fn as_node_ref<C, Inner>(&self) -> Child<&Inner, &T>
pub fn as_node_ref<C, Inner>(&self) -> Child<&Inner, &T>
Sourcepub fn as_node_mut<C, Inner>(&mut self) -> Child<&mut Inner, &mut T>
pub fn as_node_mut<C, Inner>(&mut self) -> Child<&mut Inner, &mut T>
Trait Implementations§
impl<Node: Copy, T: Copy> Copy for Child<Node, T>
impl<Node: Eq, T: Eq> Eq for Child<Node, T>
Source§impl<Node: PartialEq, T: PartialEq> PartialEq for Child<Node, T>
impl<Node: PartialEq, T: PartialEq> PartialEq for Child<Node, T>
impl<Node, T> StructuralPartialEq for Child<Node, T>
Auto Trait Implementations§
impl<Node, T> Freeze for Child<Node, T>
impl<Node, T> RefUnwindSafe for Child<Node, T>where
Node: RefUnwindSafe,
T: RefUnwindSafe,
impl<Node, T> Send for Child<Node, T>
impl<Node, T> Sync for Child<Node, T>
impl<Node, T> Unpin for Child<Node, T>
impl<Node, T> UnsafeUnpin for Child<Node, T>where
Node: UnsafeUnpin,
T: UnsafeUnpin,
impl<Node, T> UnwindSafe for Child<Node, T>where
Node: UnwindSafe,
T: UnwindSafe,
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