Enum btree_slab::generic::node::Node [−][src]
B-tree node.
Variants
Internal(InternalNode<K, V>)
Internal node.
Leaf(LeafNode<K, V>)
Leaf node.
Implementations
impl<K, V> Node<K, V>
[src]
pub fn binary(
parent: Option<usize>,
left_id: usize,
median: Item<K, V>,
right_id: usize
) -> Node<K, V>
[src]
parent: Option<usize>,
left_id: usize,
median: Item<K, V>,
right_id: usize
) -> Node<K, V>
pub fn leaf(parent: Option<usize>, item: Item<K, V>) -> Node<K, V>
[src]
pub fn balance(&self) -> Balance
[src]
pub fn is_underflowing(&self) -> bool
[src]
pub fn is_overflowing(&self) -> bool
[src]
pub fn parent(&self) -> Option<usize>
[src]
pub fn set_parent(&mut self, p: Option<usize>)
[src]
pub fn item_count(&self) -> usize
[src]
pub fn child_count(&self) -> usize
[src]
pub fn child_index(&self, id: usize) -> Option<usize>
[src]
pub fn child_id(&self, index: usize) -> usize
[src]
pub fn child_id_opt(&self, index: usize) -> Option<usize>
[src]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Result<Option<&V>, usize> where
K: Borrow<Q>,
Q: Ord,
[src]
K: Borrow<Q>,
Q: Ord,
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<&mut V>, usize> where
K: Borrow<Q>,
Q: Ord,
[src]
K: Borrow<Q>,
Q: Ord,
pub fn offset_of<Q: ?Sized>(
&self,
key: &Q
) -> Result<Offset, (usize, Option<usize>)> where
K: Borrow<Q>,
Q: Ord,
[src]
&self,
key: &Q
) -> Result<Offset, (usize, Option<usize>)> where
K: Borrow<Q>,
Q: Ord,
Find the offset of the item matching the given key.
If the key matches no item in this node,
this funtion returns the index and id of the child that may match the key,
or Err(None)
if it is a leaf.
pub fn item(&self, offset: Offset) -> Option<&Item<K, V>>
[src]
pub fn item_mut(&mut self, offset: Offset) -> Option<&mut Item<K, V>>
[src]
pub fn insert_by_key(
&mut self,
key: K,
value: V
) -> Result<(Offset, Option<V>), (K, V, usize, usize)> where
K: Ord,
[src]
&mut self,
key: K,
value: V
) -> Result<(Offset, Option<V>), (K, V, usize, usize)> where
K: Ord,
Insert by key.
It is assumed that the node is not free. If it is a leaf node, there must be a free space in it for the inserted value.
pub fn split(&mut self) -> (usize, Item<K, V>, Node<K, V>)
[src]
Split the node. Return the length of the node after split, the median item and the right node.
pub fn merge(
&mut self,
left_index: usize,
right_index: usize
) -> (usize, usize, usize, Item<K, V>, Balance)
[src]
&mut self,
left_index: usize,
right_index: usize
) -> (usize, usize, usize, Item<K, V>, Balance)
pub fn append(&mut self, separator: Item<K, V>, other: Node<K, V>) -> Offset
[src]
Return the offset of the separator.
pub fn push_left(&mut self, item: Item<K, V>, opt_child_id: Option<usize>)
[src]
pub fn pop_left(
&mut self
) -> Result<(Item<K, V>, Option<usize>), WouldUnderflow>
[src]
&mut self
) -> Result<(Item<K, V>, Option<usize>), WouldUnderflow>
pub fn push_right(
&mut self,
item: Item<K, V>,
opt_child_id: Option<usize>
) -> Offset
[src]
&mut self,
item: Item<K, V>,
opt_child_id: Option<usize>
) -> Offset
pub fn pop_right(
&mut self
) -> Result<(Offset, Item<K, V>, Option<usize>), WouldUnderflow>
[src]
&mut self
) -> Result<(Offset, Item<K, V>, Option<usize>), WouldUnderflow>
pub fn leaf_remove(
&mut self,
offset: Offset
) -> Option<Result<Item<K, V>, usize>>
[src]
&mut self,
offset: Offset
) -> Option<Result<Item<K, V>, usize>>
pub fn remove(
&mut self,
offset: Offset
) -> Result<Item<K, V>, (usize, Item<K, V>, usize)>
[src]
&mut self,
offset: Offset
) -> Result<Item<K, V>, (usize, Item<K, V>, usize)>
Remove the item at the given offset.
pub fn remove_rightmost_leaf(&mut self) -> Result<Item<K, V>, usize>
[src]
pub fn insert(
&mut self,
offset: Offset,
item: Item<K, V>,
opt_right_child_id: Option<usize>
)
[src]
&mut self,
offset: Offset,
item: Item<K, V>,
opt_right_child_id: Option<usize>
)
Put an item in a node.
It is assumed that the node will not overflow.
pub fn replace(&mut self, offset: Offset, item: Item<K, V>) -> Item<K, V>
[src]
pub fn separators(&self, i: usize) -> (Option<&K>, Option<&K>)
[src]
pub fn children(&self) -> Children<'_, K, V>ⓘ
[src]
pub fn children_with_separators(&self) -> ChildrenWithSeparators<'_, K, V>ⓘ
[src]
pub fn validate(&self, parent: Option<usize>, min: Option<&K>, max: Option<&K>) where
K: Ord,
[src]
K: Ord,
Trait Implementations
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Node<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Node<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for Node<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for Node<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for Node<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
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> 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>,