[][src]Struct oasis_std::collections::map::Map

pub struct Map<K, V> { /* fields omitted */ }

Map is a data structure with a HashMap-like API but based on a Vec. It's primarily useful when you care about constant factors or prefer determinism to speed. Please refer to the docs for HashMap for details and examples of the Map API.

Example

use oasis_std::collections::Map;
let mut map = Map::new();
map.insert("hello".to_string(), "world".to_string());
map.entry("hello".to_string())
    .and_modify(|mut v| v.push_str("!"));
assert_eq!(map.get("hello").map(String::as_str), Some("world!"))

Methods

impl<K: Eq, V> Map<K, V>[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn capacity(&self) -> usize[src]

pub fn clear(&mut self)[src]

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn drain(&mut self) -> Drain<(K, V)>[src]

pub fn entry(&mut self, key: K) -> Entry<K, V>[src]

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn get_key_value<Q: ?Sized>(&self, key: &Q) -> Option<(&K, &V)> where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]

pub fn is_empty(&self) -> bool[src]

pub fn iter(
    &self
) -> impl Iterator<Item = (&K, &V)> + DoubleEndedIterator + ExactSizeIterator
[src]

pub fn iter_mut(
    &mut self
) -> impl Iterator<Item = (&mut K, &mut V)> + DoubleEndedIterator + ExactSizeIterator
[src]

pub fn keys(
    &self
) -> impl Iterator<Item = &K> + DoubleEndedIterator + ExactSizeIterator
[src]

pub fn len(&self) -> usize[src]

pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn remove_entry<Q: ?Sized>(&mut self, key: &Q) -> Option<(K, V)> where
    K: Borrow<Q>,
    Q: Eq
[src]

pub fn reserve(&mut self, additional: usize)[src]

pub fn retain(&mut self, f: impl FnMut(&K, &mut V) -> bool)[src]

pub fn shrink_to(&mut self, min_capacity: usize)[src]

pub fn shrink_to_fit(&mut self)[src]

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>[src]

pub fn values(
    &self
) -> impl Iterator<Item = &V> + DoubleEndedIterator + ExactSizeIterator
[src]

pub fn values_mut(
    &mut self
) -> impl Iterator<Item = &mut V> + DoubleEndedIterator + ExactSizeIterator
[src]

Trait Implementations

impl<K, V> BorshDeserialize for Map<K, V> where
    K: BorshDeserialize + Eq,
    V: BorshDeserialize
[src]

impl<K, V> BorshSerialize for Map<K, V> where
    K: BorshSerialize + PartialOrd,
    V: BorshSerialize
[src]

impl<K: Clone, V: Clone> Clone for Map<K, V>[src]

impl<K: Debug, V: Debug> Debug for Map<K, V>[src]

impl<K: Default, V: Default> Default for Map<K, V>[src]

impl<K: Eq, V: Eq> Eq for Map<K, V>[src]

impl<'a, K: 'a + Copy + Eq, V: 'a + Copy> Extend<(&'a K, &'a V)> for Map<K, V>[src]

impl<K: Eq, V> Extend<(K, V)> for Map<K, V>[src]

impl<K: Eq, V> FromIterator<(K, V)> for Map<K, V>[src]

impl<'_, Q: Eq + ?Sized, K: Eq + Borrow<Q>, V> Index<&'_ Q> for Map<K, V>[src]

type Output = V

The returned type after indexing.

impl<'a, K, V> IntoIterator for &'a Map<K, V>[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Map<Iter<'a, (K, V)>, fn(_: &'a (K, V)) -> (&'a K, &'a V)>

Which kind of iterator are we turning this into?

impl<'a, K, V> IntoIterator for &'a mut Map<K, V>[src]

type Item = (&'a mut K, &'a mut V)

The type of the elements being iterated over.

type IntoIter = Map<IterMut<'a, (K, V)>, fn(_: &'a mut (K, V)) -> (&'a mut K, &'a mut V)>

Which kind of iterator are we turning this into?

impl<K, V> IntoIterator for Map<K, V>[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<(K, V)>

Which kind of iterator are we turning this into?

impl<K: PartialEq, V: PartialEq> PartialEq<Map<K, V>> for Map<K, V>[src]

impl<K, V> StructuralEq for Map<K, V>[src]

impl<K, V> StructuralPartialEq for Map<K, V>[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for Map<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for Map<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Map<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Map<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Map<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,