pub struct SharedBTreeMap<K: Copy + Ord + Default + 'static, V: Copy + Default + 'static> { /* private fields */ }Implementations§
Sourcepub fn create(
path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, BTreeError>
pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, BTreeError>
Obtain the map at path, initializing an empty one if the path
does not yet exist and attaching to it if it does. Attaching
leaves the live tree in place; a region built with a different
capacity is a LayoutMismatch. reset
reinitializes.
Sourcepub fn reset(
path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, BTreeError>
pub fn reset( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, BTreeError>
Truncate the map at path and initialize an empty one,
discarding the tree live peers share. For a caller that knows it
owns the path.
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, BTreeError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes bump-allocated so far (resident-memory witness:
node_count() * size_of::<BTreeNode>()).
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
True if key is present.
Sourcepub fn insert(&self, key: K, value: V) -> Result<Option<V>, BTreeError>
pub fn insert(&self, key: K, value: V) -> Result<Option<V>, BTreeError>
Insert / update. Single-writer (serialise externally). Returns the
previous value if key was present.
Sourcepub fn remove(&self, key: &K) -> Result<Option<V>, BTreeError>
pub fn remove(&self, key: &K) -> Result<Option<V>, BTreeError>
Remove key, returning its previous value if present. Single-writer
(serialise externally, as with insert).
Sourcepub fn iter_ascending(&self) -> Vec<(K, V)>
pub fn iter_ascending(&self) -> Vec<(K, V)>
Collect all (K, V) in ascending key order (validation / iteration).