Expand description
BTreeMap similar to std::collections::BTreeMap.
§Differences compared to std::collections::BTreeMap
This BTreeMap does not treat a map being out-of-order as unsafe ( since this cannot be guaranteed for all key types in any case ).
So CursorMut::with_mutable_key, CursorMutKey::insert_before_unchecked
and CursorMutKey::insert_after_unchecked are not marked as unsafe and
crates should not rely on arbitrary maps being ordered for safety.
This BTreeMap has the trait Tuning which gives control over the allocation
of the map in addition to where it is allocated via the Allocator trait.
This and other implementation differences mean that less memory is allocated.
Performance is mostly similar, but clone and serde deserialisation are significantly faster.
§Example
use pstd::collections::btree_map::BTreeMap;
let mut mymap = BTreeMap::new();
mymap.insert("England", "London");
mymap.insert("France", "Paris");
println!("The capital of France is {}", mymap["France"]);§Features
This crate supports the following cargo features:
serde: enables serialisation ofBTreeMapvia serde crate.unsafe-optim: uses unsafe code for extra optimisation.
Structs§
- BTree
Map BTreeMapsimilar tostd::collections::BTreeMap.- Cursor
- Cursor returned by
BTreeMap::lower_bound,BTreeMap::upper_bound. - Cursor
Mut - Cursor that allows mutation of map, returned by
BTreeMap::lower_bound_mut,BTreeMap::upper_bound_mut. - Cursor
MutKey - Cursor that allows mutation of map keys, returned by
CursorMut::with_mutable_key. - Custom
Tuning - Implementation of Tuning. Default branch is 64, default allocation unit is 16.
- Extract
If - Iterator returned by
BTreeMap::extract_if. - Into
Iter - Consuming iterator for
BTreeMap. - Into
Keys - Consuming iterator returned by
BTreeMap::into_keys. - Into
Values - Consuming iterator returned by
BTreeMap::into_values. - Iter
- Iterator returned by
BTreeMap::iter. - IterMut
- Iterator returned by
BTreeMap::iter_mut. - Keys
- Iterator returned by
BTreeMap::keys. - Occupied
Entry - Occupied Entry.
- Occupied
Error - Error returned by
BTreeMap::try_insert. - Range
- Iterator returned by
BTreeMap::range. - Range
Mut - Iterator returned by
BTreeMap::range_mut. - Unordered
KeyError - Error type for
CursorMut::insert_beforeandCursorMut::insert_after. - Vacant
Entry - Vacant Entry.
- Values
- Iterator returned by
BTreeMap::values. - Values
Mut - Iterator returned by
BTreeMap::values_mut.
Enums§
- Entry
- Entry in
BTreeMap, returned byBTreeMap::entry. - Full
Action - Type returned by Tuning::full_action.
Traits§
Type Aliases§
- Default
Tuning - Default allocation tuning.