Struct scrypto::prelude::NonIterMap
pub struct NonIterMap<K, V, S = RandomState>(HashMap<K, V, S>)
where
K: Eq + Hash,
S: BuildHasher;
Expand description
A thin wrapper around a HashMap
, which guarantees that a HashMap
usage will not
result in a non-deterministic execution (simply by disallowing the iteration over its
elements).
Tuple Fields§
§0: HashMap<K, V, S>
Implementations§
§impl<K, V> NonIterMap<K, V>
impl<K, V> NonIterMap<K, V>
pub fn new() -> NonIterMap<K, V>
pub fn new() -> NonIterMap<K, V>
Creates an empty map.
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
Gets the given key’s corresponding entry in the map for in-place manipulation.
pub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the map. If the map did not have this key present, None is returned. If the map did have this key present, the value is updated, and the old value is returned.
pub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Returns a reference to the value corresponding to the key.
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
pub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true if the map contains a value for the specified key.
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Removes a key from the map, returning the value at the key if the key was previously in the map.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clears the map, removing all key-value pairs.
Trait Implementations§
§impl<K, V, S> Clone for NonIterMap<K, V, S>
impl<K, V, S> Clone for NonIterMap<K, V, S>
§fn clone(&self) -> NonIterMap<K, V, S>
fn clone(&self) -> NonIterMap<K, V, S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<K, V, S> Debug for NonIterMap<K, V, S>
impl<K, V, S> Debug for NonIterMap<K, V, S>
§impl<K, V> Default for NonIterMap<K, V>
impl<K, V> Default for NonIterMap<K, V>
§fn default() -> NonIterMap<K, V>
fn default() -> NonIterMap<K, V>
§impl<K, V> FromIterator<(K, V)> for NonIterMap<K, V>
impl<K, V> FromIterator<(K, V)> for NonIterMap<K, V>
§fn from_iter<T>(iter: T) -> NonIterMap<K, V>where
T: IntoIterator<Item = (K, V)>,
fn from_iter<T>(iter: T) -> NonIterMap<K, V>where
T: IntoIterator<Item = (K, V)>,
§impl<K, V, S> PartialEq for NonIterMap<K, V, S>
impl<K, V, S> PartialEq for NonIterMap<K, V, S>
§fn eq(&self, other: &NonIterMap<K, V, S>) -> bool
fn eq(&self, other: &NonIterMap<K, V, S>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<K, V, S> Eq for NonIterMap<K, V, S>
impl<K, V, S> StructuralPartialEq for NonIterMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> RefUnwindSafe for NonIterMap<K, V, S>
impl<K, V, S> Send for NonIterMap<K, V, S>
impl<K, V, S> Sync for NonIterMap<K, V, S>
impl<K, V, S> Unpin for NonIterMap<K, V, S>
impl<K, V, S> UnwindSafe for NonIterMap<K, V, S>
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.