Module sanakirja::btree [−][src]
Expand description
An implementation of B trees. The core operations on B trees
(lookup, iterate, put and del) are generic in the actual
implementation of nodes, via the BTreePage
and
BTreeMutPage
. This allows for a simpler code for the
high-level functions, as well as specialised, high-performance
implementations for the nodes.
Two different implementations are supplied: one in page
for
types with a size known at compile-time, which yields denser
leaves, and hence shallower trees (if the values are really using
the space). The other one, in page_unsized
, is for
dynamic-sized types, or types whose representation is dynamic, for
example enums that are Sized
in Rust, but whose cases vary
widely in size.
Modules
Deletions from a B tree.
Implementation of B tree pages for Sized types, i.e. types whose
representation has a size known at compile time (and the same as
core::mem::size_of()
).
Implementation of B tree pages for Unsized types, or types with an dynamically-sized representation (for example enums with widely different sizes).
Insertions into a B tree.
Structs
A position in a B tree.
A database, which is essentially just a page offset along with markers.
Traits
Functions
Create a database for sized keys and values.
Create a database with an arbitrary page implementation.
If value
is None
, delete the first entry for key
from the
database, if present. Else, delete the entry for (key, value)
,
if present.
Drop a database recursively, dropping all referenced keys and values that aren’t shared with other databases.
Fork a database.
Get the first entry of a database greater than or equal to k
(or
to (k, v)
if v.is_some()
).
Insert an entry into a database, returning false
if and only if
the exact same entry (key and value) was already in the
database.