pub struct NonIterMap<K, V, S = RandomState>(/* private fields */)
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).
Implementations§
Source§impl<K, V> NonIterMap<K, V>
impl<K, V> NonIterMap<K, V>
Sourcepub fn new() -> NonIterMap<K, V>
pub fn new() -> NonIterMap<K, V>
Creates an empty map.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Trait Implementations§
Source§impl<K, V, S> Clone for NonIterMap<K, V, S>
impl<K, V, S> Clone for NonIterMap<K, V, S>
Source§fn clone(&self) -> NonIterMap<K, V, S>
fn clone(&self) -> NonIterMap<K, V, S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<K, V, S> Debug for NonIterMap<K, V, S>
impl<K, V, S> Debug for NonIterMap<K, V, S>
Source§impl<K, V> Default for NonIterMap<K, V>
impl<K, V> Default for NonIterMap<K, V>
Source§fn default() -> NonIterMap<K, V>
fn default() -> NonIterMap<K, V>
Returns the “default value” for a type. Read more
Source§impl<K, V> FromIterator<(K, V)> for NonIterMap<K, V>
impl<K, V> FromIterator<(K, V)> for NonIterMap<K, V>
Source§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)>,
Creates a value from an iterator. Read more
Source§impl<K, V, S> PartialEq for NonIterMap<K, V, S>
impl<K, V, S> PartialEq for NonIterMap<K, V, S>
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> Freeze for NonIterMap<K, V, S>where
S: Freeze,
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§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key
and return true
if they are equal.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
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more