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

Make a new tree.

Failures

Returns None if allocation fails.

Make a new tree.

Failures

Returns None if allocation fails.

Return number of elements.

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.

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.

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.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.