[−][src]Struct oasis_std::collections::map::Map
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]
K: Borrow<Q>,
Q: Eq,
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]
K: Borrow<Q>,
Q: Eq,
pub fn get_key_value<Q: ?Sized>(&self, key: &Q) -> Option<(&K, &V)> where
K: Borrow<Q>,
Q: Eq,
[src]
K: Borrow<Q>,
Q: Eq,
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq,
[src]
K: Borrow<Q>,
Q: Eq,
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]
&self
) -> impl Iterator<Item = (&K, &V)> + DoubleEndedIterator + ExactSizeIterator
pub fn iter_mut(
&mut self
) -> impl Iterator<Item = (&mut K, &mut V)> + DoubleEndedIterator + ExactSizeIterator
[src]
&mut self
) -> impl Iterator<Item = (&mut K, &mut V)> + DoubleEndedIterator + ExactSizeIterator
pub fn keys(
&self
) -> impl Iterator<Item = &K> + DoubleEndedIterator + ExactSizeIterator
[src]
&self
) -> impl Iterator<Item = &K> + DoubleEndedIterator + ExactSizeIterator
pub fn len(&self) -> usize
[src]
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where
K: Borrow<Q>,
Q: Eq,
[src]
K: Borrow<Q>,
Q: Eq,
pub fn remove_entry<Q: ?Sized>(&mut self, key: &Q) -> Option<(K, V)> where
K: Borrow<Q>,
Q: Eq,
[src]
K: Borrow<Q>,
Q: Eq,
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]
&self
) -> impl Iterator<Item = &V> + DoubleEndedIterator + ExactSizeIterator
pub fn values_mut(
&mut self
) -> impl Iterator<Item = &mut V> + DoubleEndedIterator + ExactSizeIterator
[src]
&mut self
) -> impl Iterator<Item = &mut V> + DoubleEndedIterator + ExactSizeIterator
Trait Implementations
impl<K, V> BorshDeserialize for Map<K, V> where
K: BorshDeserialize + Eq,
V: BorshDeserialize,
[src]
K: BorshDeserialize + Eq,
V: BorshDeserialize,
fn deserialize<R: Read>(reader: &mut R) -> Result<Self, Error>
[src]
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
[src]
impl<K, V> BorshSerialize for Map<K, V> where
K: BorshSerialize + PartialOrd,
V: BorshSerialize,
[src]
K: BorshSerialize + PartialOrd,
V: BorshSerialize,
fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>
[src]
fn try_to_vec(&self) -> Result<Vec<u8>, Error>
[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]
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
[src]
impl<K: Eq, V> FromIterator<(K, V)> for Map<K, V>
[src]
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self
[src]
impl<'_, Q: Eq + ?Sized, K: Eq + Borrow<Q>, V> Index<&'_ Q> for Map<K, V>
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
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,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for Map<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for Map<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for Map<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,