pub struct OwnedMap<K, V> { /* private fields */ }Expand description
An ordinary mutable ordered map with exact node ownership. Unlike BudgetedMap, insertion has no allowance and cannot be used as an admitted producer by itself. An enclosing controlled producer must reserve entry_bytes() before allocating each new entry and retain that lease until the map is dropped. Separately allocated key/value payloads require their own reservations.
Implementations§
Source§impl<K, V> OwnedMap<K, V>
impl<K, V> OwnedMap<K, V>
pub fn new() -> Self
Sourcepub const fn entry_bytes() -> usize
pub const fn entry_bytes() -> usize
Exact allocation layout of one node, including its key, value, links and padding. Allocator bookkeeping is outside the payload allowance.
pub fn allocated_bytes(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> BudgetedMapIter<'_, K, V> ⓘ
pub fn keys(&self) -> impl ExactSizeIterator<Item = &K> + FusedIterator
pub fn values(&self) -> impl ExactSizeIterator<Item = &V> + FusedIterator
Source§impl<K: Ord, V> OwnedMap<K, V>
impl<K: Ord, V> OwnedMap<K, V>
pub fn get<Q: Ord + ?Sized>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
pub fn get_mut<Q: Ord + ?Sized>(&mut self, key: &Q) -> Option<&mut V>where
K: Borrow<Q>,
pub fn contains_key<Q: Ord + ?Sized>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
A collision replaces only the value, preserving the original key and node allocation.
Sourcepub fn append(&mut self, other: Self)
pub fn append(&mut self, other: Self)
Move entries from other without allocating replacement nodes. Collisions retain this map’s original key and node, replacing only the value.
pub fn remove<Q: Ord + ?Sized>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
pub fn remove_entry<Q: Ord + ?Sized>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
Trait Implementations§
impl<K: Eq, V: Eq> Eq for OwnedMap<K, V>
Source§impl<'a, K, V> IntoIterator for &'a OwnedMap<K, V>
impl<'a, K, V> IntoIterator for &'a OwnedMap<K, V>
Source§impl<K, V> IntoIterator for OwnedMap<K, V>
impl<K, V> IntoIterator for OwnedMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for OwnedMap<K, V>
impl<K, V> RefUnwindSafe for OwnedMap<K, V>where
Option<OwnedNode<K, V>>: RefUnwindSafe,
impl<K, V> Send for OwnedMap<K, V>
impl<K, V> Sync for OwnedMap<K, V>
impl<K, V> Unpin for OwnedMap<K, V>
impl<K, V> UnsafeUnpin for OwnedMap<K, V>where
Option<OwnedNode<K, V>>: UnsafeUnpin,
impl<K, V> UnwindSafe for OwnedMap<K, V>where
Option<OwnedNode<K, V>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more