Enum btree_slab::generic::node::Node[][src]

pub enum Node<K, V> {
    Internal(InternalNode<K, V>),
    Leaf(LeafNode<K, V>),
}

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]

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]

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<&mut V>, usize> where
    K: Borrow<Q>,
    Q: Ord
[src]

pub fn offset_of<Q: ?Sized>(
    &self,
    key: &Q
) -> Result<Offset, (usize, Option<usize>)> where
    K: Borrow<Q>,
    Q: Ord
[src]

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]

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]

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]

pub fn push_right(
    &mut self,
    item: Item<K, V>,
    opt_child_id: Option<usize>
) -> Offset
[src]

pub fn pop_right(
    &mut self
) -> Result<(Offset, Item<K, V>, Option<usize>), WouldUnderflow>
[src]

pub fn leaf_remove(
    &mut self,
    offset: Offset
) -> Option<Result<Item<K, V>, usize>>
[src]

pub fn remove(
    &mut self,
    offset: Offset
) -> Result<Item<K, V>, (usize, Item<K, V>, usize)>
[src]

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]

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>

Notable traits for Children<'a, K, V>

impl<'a, K, V> Iterator for Children<'a, K, V> type Item = usize;
[src]

pub fn children_with_separators(&self) -> ChildrenWithSeparators<'_, K, V>

Notable traits for ChildrenWithSeparators<'a, K, V>

impl<'a, K, V> Iterator for ChildrenWithSeparators<'a, K, V> type Item = (Option<&'a Item<K, V>>, usize, Option<&'a Item<K, V>>);
[src]

pub fn validate(&self, parent: Option<usize>, min: Option<&K>, max: Option<&K>) where
    K: Ord
[src]

Trait Implementations

impl<K: Clone, V: Clone> Clone for Node<K, V>[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for Node<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for Node<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Node<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Node<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Node<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.