pub struct BudgetedSharedMap<K, V> { /* private fields */ }Expand description
A persistent ordered map with logarithmic lookup and insertion. Cloning shares a root without copying entries or allocating. Updates reserve the complete insertion before mutation, reuse unique nodes and copy shared paths; unchanged entries and subtrees keep their original reservations until their last root is dropped. Keys and values retain their separately owned payloads.
Implementations§
pub fn get<Q: Ord + ?Sized>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
Sourcepub fn with_insert(&self, key: K, value: V) -> Result<Self, MemoryError>
pub fn with_insert(&self, key: K, value: V) -> Result<Self, MemoryError>
Return a new root containing the supplied key and value, leaving this root unchanged even if reservation fails. Matching keys are replaced together with their values; neither type needs to implement Clone.
Sourcepub fn try_insert(&mut self, key: K, value: V) -> Result<(), MemoryError>
pub fn try_insert(&mut self, key: K, value: V) -> Result<(), MemoryError>
Reserve the complete insertion before changing this root, reusing unique nodes and copying only shared paths. Reservation failure preserves this root; existing clones remain unchanged. Matching keys and values are replaced together without requiring Clone.
Sourcepub fn range_from<Q: Ord + ?Sized>(
&self,
start: Bound<&Q>,
) -> BudgetedSharedMapIter<'_, K, V> ⓘwhere
K: Borrow<Q>,
pub fn range_from<Q: Ord + ?Sized>(
&self,
start: Bound<&Q>,
) -> BudgetedSharedMapIter<'_, K, V> ⓘwhere
K: Borrow<Q>,
Visit keys in order, seeking the lower bound without traversing earlier entries or allocating a traversal buffer.