#[repr(u8)]
pub enum NodeType {
Node4,
Node16,
Node48,
Node256,
Leaf,
}
Expand description
The representation of inner nodes
Variants§
Node4
Node that references between 2 and 4 children
Node16
Node that references between 5 and 16 children
Node48
Node that references between 17 and 49 children
Node256
Node that references between 49 and 256 children
Leaf
Node that contains a single value
Implementations§
source§impl NodeType
impl NodeType
sourcepub const fn upper_capacity(self) -> usize
pub const fn upper_capacity(self) -> usize
The upper bound on the number of child nodes that this NodeType can have.
sourcepub const fn from_u8(src: u8) -> Option<NodeType>
pub const fn from_u8(src: u8) -> Option<NodeType>
Attempt to convert a u8 value to a NodeType
, returning None if there
is no match.
sourcepub fn should_shrink_inner_node(self, num_children: usize) -> bool
pub fn should_shrink_inner_node(self, num_children: usize) -> bool
Return true if an InnerNode
with the given NodeType
and
specified number of children should be shrunk.
Panics
- Panics if
node_type
equalsNodeType::Leaf
sourcepub const fn capacity_range(self) -> Range<usize>
pub const fn capacity_range(self) -> Range<usize>
Return the range of number of children that each node type accepts.
Trait Implementations§
source§impl PartialEq<NodeType> for NodeType
impl PartialEq<NodeType> for NodeType
impl Copy for NodeType
impl Eq for NodeType
impl StructuralEq for NodeType
impl StructuralPartialEq for NodeType
Auto Trait Implementations§
impl RefUnwindSafe for NodeType
impl Send for NodeType
impl Sync for NodeType
impl Unpin for NodeType
impl UnwindSafe for NodeType
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