Struct non_empty_collections::index_map::NonEmptyIndexMap [−][src]
pub struct NonEmptyIndexMap<K, V, S = RandomState> { /* fields omitted */ }
A wrapper around ::indexmap::IndexMap that is guaranteed to have at least one element by the
Rust's type system: it consists of a first element and an indexed map (which could be
empty) rest elements.
Methods
impl<K, V> NonEmptyIndexMap<K, V, RandomState>[src]
impl<K, V> NonEmptyIndexMap<K, V, RandomState>pub fn new(key: K, value: V) -> Self[src]
pub fn new(key: K, value: V) -> SelfCreates a map with a default hasher.
pub fn with_capacity(key: K, value: V, capacity: usize) -> Self[src]
pub fn with_capacity(key: K, value: V, capacity: usize) -> SelfCreates a map with a given capacity.
pub fn from_item_and_iterator(
key: K,
value: V,
i: impl IntoIterator<Item = (K, V)>
) -> Self where
K: Hash + Eq, [src]
pub fn from_item_and_iterator(
key: K,
value: V,
i: impl IntoIterator<Item = (K, V)>
) -> Self where
K: Hash + Eq, Creates a map from an item (a key and a value pair) standart hash map.
pub fn from_iterator(
i: impl IntoIterator<Item = (K, V)>
) -> Result<Self, Error> where
K: Hash + Eq, [src]
pub fn from_iterator(
i: impl IntoIterator<Item = (K, V)>
) -> Result<Self, Error> where
K: Hash + Eq, Creates a map from a given iterator with a default hasher.
impl<K, V, S> NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, [src]
impl<K, V, S> NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, pub fn with_hasher(key: K, value: V, hash_builder: S) -> Self[src]
pub fn with_hasher(key: K, value: V, hash_builder: S) -> SelfCreates a map with a given hasher.
pub fn with_capacity_and_hasher(
key: K,
value: V,
capacity: usize,
hash_builder: S
) -> Self[src]
pub fn with_capacity_and_hasher(
key: K,
value: V,
capacity: usize,
hash_builder: S
) -> SelfCreates a map with a given capacity and a given hasher.
pub fn iter(
&self
) -> impl Iterator<Item = (&K, &V)>[src]
pub fn iter(
&self
) -> impl Iterator<Item = (&K, &V)>Iterates over key-value pairs of the map in an immutable way.
pub fn iter_mut(
&mut self
) -> impl Iterator<Item = (&K, &mut V)>[src]
pub fn iter_mut(
&mut self
) -> impl Iterator<Item = (&K, &mut V)>Iterates over key-value pairs of the map in a mutable way.
pub fn from_iter_with_hasher(
i: impl IntoIterator<Item = (K, V)>,
hasher: S
) -> Result<Self, Error>[src]
pub fn from_iter_with_hasher(
i: impl IntoIterator<Item = (K, V)>,
hasher: S
) -> Result<Self, Error>Creates a map from a given iterator with a given hasher.
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Eq + Hash, [src]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Eq + Hash, Gets a value associated with a given key, if any.
pub fn contains<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash, [src]
pub fn contains<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash, Checks whether a given key exists in the map.
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash, [src]
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
K: Borrow<Q>,
Q: Eq + Hash, Gets a value associated with a given key, if any.
pub fn remove_entry<Q: ?Sized>(
&mut self,
key: &Q
) -> Result<Option<(K, V)>, Error> where
K: Borrow<Q>,
Q: Eq + Hash, [src]
pub fn remove_entry<Q: ?Sized>(
&mut self,
key: &Q
) -> Result<Option<(K, V)>, Error> where
K: Borrow<Q>,
Q: Eq + Hash, Removes and returns an element associated with a given key, if any.
An attempt to remove the last element will cause an Error to be returned.
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<V>, Error> where
K: Borrow<Q>,
Q: Eq + Hash, [src]
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<V>, Error> where
K: Borrow<Q>,
Q: Eq + Hash, Removes and element associated with a given key and return its value, if any.
An attempt to remove the last element will cause an Error to be returned.
pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]
pub fn insert(&mut self, key: K, value: V) -> Option<V>Inserts a key-value pair into the map. If the map have already had an element associated with a given key, the associated value is updated and the old one is returned.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeReturns the number of elements in the map.
pub fn entry(&mut self, key: K) -> Entry<K, V, S>[src]
pub fn entry(&mut self, key: K) -> Entry<K, V, S>Returns an entry that corresponds to a given key.
pub fn get_first(&self) -> (&K, &V)[src]
pub fn get_first(&self) -> (&K, &V)Gets an immutable reference to the firs element (only the value).
pub fn get_first_mut(&mut self) -> (&mut K, &mut V)[src]
pub fn get_first_mut(&mut self) -> (&mut K, &mut V)Gets a mutable reference to the firs element (only the value).
pub fn get_rest(&self) -> &IndexMap<K, V, S>[src]
pub fn get_rest(&self) -> &IndexMap<K, V, S>Gets an immutable reference to the rest indexed map of elements.
pub fn get_rest_mut(&mut self) -> &mut IndexMap<K, V, S>[src]
pub fn get_rest_mut(&mut self) -> &mut IndexMap<K, V, S>Gets a mutable reference to the rest indexed map of elements.
Trait Implementations
impl<'de, K, V, S> Deserialize<'de> for NonEmptyIndexMap<K, V, S> where
K: Deserialize<'de>,
V: Deserialize<'de>,
K: Eq + Hash,
S: BuildHasher + Default, [src]
impl<'de, K, V, S> Deserialize<'de> for NonEmptyIndexMap<K, V, S> where
K: Deserialize<'de>,
V: Deserialize<'de>,
K: Eq + Hash,
S: BuildHasher + Default, fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
impl<K, V, H> Serialize for NonEmptyIndexMap<K, V, H> where
K: Serialize,
V: Serialize,
K: Eq + Hash,
H: BuildHasher, [src]
impl<K, V, H> Serialize for NonEmptyIndexMap<K, V, H> where
K: Serialize,
V: Serialize,
K: Eq + Hash,
H: BuildHasher, fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer, [src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer, Serialize this value into the given Serde serializer. Read more
impl<K: Clone, V: Clone, S: Clone> Clone for NonEmptyIndexMap<K, V, S>[src]
impl<K: Clone, V: Clone, S: Clone> Clone for NonEmptyIndexMap<K, V, S>fn clone(&self) -> NonEmptyIndexMap<K, V, S>[src]
fn clone(&self) -> NonEmptyIndexMap<K, V, S>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<K: Eq + Hash, V, S: BuildHasher> Into<IndexMap<K, V, S>> for NonEmptyIndexMap<K, V, S>[src]
impl<K: Eq + Hash, V, S: BuildHasher> Into<IndexMap<K, V, S>> for NonEmptyIndexMap<K, V, S>impl<K, V, S> Debug for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash + Debug,
V: Debug,
S: BuildHasher, [src]
impl<K, V, S> Debug for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash + Debug,
V: Debug,
S: BuildHasher, fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<K, V, S> Extend<(K, V)> for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, [src]
impl<K, V, S> Extend<(K, V)> for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)[src]
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)Extends a collection with the contents of an iterator. Read more
impl<K, V, S> IntoIterator for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, [src]
impl<K, V, S> IntoIterator for NonEmptyIndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher, Auto Trait Implementations
impl<K, V, S> Send for NonEmptyIndexMap<K, V, S> where
K: Send,
S: Send,
V: Send,
impl<K, V, S> Send for NonEmptyIndexMap<K, V, S> where
K: Send,
S: Send,
V: Send, impl<K, V, S> Sync for NonEmptyIndexMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Sync for NonEmptyIndexMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,