Struct containers::collections::b_tree::BTree [−][src]
pub struct BTree<K, T, Rel: TotalOrderRelation<K> = Core, A: Alloc = NullAllocator> { /* fields omitted */ }
Expand description
A B-node has m
key-value pairs, and m+1
children if it is a stem, with the keys between
the children so each key is greater than all keys in its left subtree and less than all keys
in its right subtree.
A node other than the root has b-1 ≤ m ≤ 2b-1
, where b
is the branching parametre of the
tree; the root may have fewer.
Implementations
Find value with given key k
.
Find value with given key k
.
Find value with minimum key.
Return None
if tree empty.
Find value with maximum key.
Return None
if tree empty.
Seek k
; if not found, insert f(None)
there; if found, modify the value there from x
to f(Some(x))
.
Failures
Returns Err
if allocation fails.
Insert x
at k
and return Some(x)
if there was already a value x
there.
Failures
Returns Err
if allocation fails.
pub fn delete_which<Q: ?Sized>(&mut self, which: Which<&Q>) -> Option<(K, T)> where
K: Borrow<Q>,
Rel: TotalOrderRelation<Q>,
pub fn delete_which<Q: ?Sized>(&mut self, which: Which<&Q>) -> Option<(K, T)> where
K: Borrow<Q>,
Rel: TotalOrderRelation<Q>,
Seek which
; if found, delete it and value x
there and return Some((k, x))
.
Seek k
; if found, delete it and value x
there and return Some((k, x))
.
Fold elements in forward order.
Fold elements in backward order.