pub struct Map<K: Zeroize, V: Zeroize>(/* private fields */);Available on crate feature
zeroize only.Expand description
An ordered map with keys and values in stable wipe-owned allocations.
Tree balancing only moves pointers. Key order is deterministic and lookup has logarithmic worst-case cost, including in no_std without random seeds.
Implementations§
Source§impl<K: Zeroize, V: Zeroize> Map<K, V>
impl<K: Zeroize, V: Zeroize> Map<K, V>
Sourcepub fn keys(&self) -> impl DoubleEndedIterator<Item = &K> + ExactSizeIterator
pub fn keys(&self) -> impl DoubleEndedIterator<Item = &K> + ExactSizeIterator
Borrow keys in ascending order.
Sourcepub fn values(&self) -> impl DoubleEndedIterator<Item = &V> + ExactSizeIterator
pub fn values(&self) -> impl DoubleEndedIterator<Item = &V> + ExactSizeIterator
Borrow values in ascending key order.
Sourcepub fn values_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = &mut V> + ExactSizeIterator
pub fn values_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut V> + ExactSizeIterator
Mutably borrow values in place, without moving their stable slots.
Source§impl<K: Zeroize + Ord, V: Zeroize> Map<K, V>
impl<K: Zeroize + Ord, V: Zeroize> Map<K, V>
Trait Implementations§
Source§impl<'de, K: Zeroize + Ord + Deserialize<'de>, V: Zeroize + Deserialize<'de>> Deserialize<'de> for Map<K, V>
Available on crate feature json only.
impl<'de, K: Zeroize + Ord + Deserialize<'de>, V: Zeroize + Deserialize<'de>> Deserialize<'de> for Map<K, V>
Available on crate feature
json only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<K: Zeroize + Ord, V: Zeroize + Eq> Eq for Map<K, V>
Source§impl<K: Zeroize + Ord, V: Zeroize> MapStorage for Map<K, V>
impl<K: Zeroize + Ord, V: Zeroize> MapStorage for Map<K, V>
Source§fn storage_len(&self) -> usize
fn storage_len(&self) -> usize
Number of entries.
Source§fn storage_insert(&mut self, key: K, value: V)
fn storage_insert(&mut self, key: K, value: V)
Insert one entry (last-write-wins, matching proto map-merge semantics).
Source§fn storage_clear(&mut self)
fn storage_clear(&mut self)
Remove all entries (the field’s cleared / default state), retaining
capacity where the underlying type allows. Invoked by the generated
message
clear().Source§fn storage_erase_key(key: &mut K)
fn storage_erase_key(key: &mut K)
Erase a key discarded before insertion, including after a later parse error.
A wipe-owning container overrides this; ordinary containers keep the default.
Implementations must not panic or allocate.
Called by binary and JSON map decoders when the
zeroize feature is
enabled, including the table codec’s partial and discarded entries.
With that feature disabled, temporary slots use ordinary Rust drop.Source§fn storage_erase_value(value: &mut V)
fn storage_erase_value(value: &mut V)
Erase a value discarded before insertion. Implementations must not panic or allocate.
Like
storage_erase_key, this hook runs only with the zeroize feature.Source§impl<K: Zeroize + Serialize, V: Zeroize + Serialize> Serialize for Map<K, V>
Available on crate feature json only.
impl<K: Zeroize + Serialize, V: Zeroize + Serialize> Serialize for Map<K, V>
Available on crate feature
json only.impl<K: Zeroize, V: Zeroize> ZeroizeOnDrop for Map<K, V>
Auto Trait Implementations§
impl<K, V> Forget for Map<K, V>
impl<K, V> Freeze for Map<K, V>
impl<K, V> Move for Map<K, V>
impl<K, V> RefUnwindSafe for Map<K, V>
impl<K, V> Send for Map<K, V>
impl<K, V> Sync for Map<K, V>
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnsafeUnpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>
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