pub struct VecMap<K, V> { /* private fields */ }Expand description
A vector-based map implementation which retains the order of inserted entries.
Internally it is represented as a Vec<(K, V)> to support keys that are neither Hash nor
Ord.
Implementations
sourceimpl<K, V> VecMap<K, V>
impl<K, V> VecMap<K, V>
sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new map. (Does not allocate.)
Examples
use vecmap::VecMap;
let mut map: VecMap<i32, &str> = VecMap::new();sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new map with capacity for capacity key-value pairs. (Does not allocate if
capacity is zero.)
Examples
use vecmap::VecMap;
let mut map: VecMap<i32, &str> = VecMap::with_capacity(10);
assert_eq!(map.len(), 0);
assert!(map.capacity() >= 10);sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of entries the map can hold without reallocating.
Examples
use vecmap::VecMap;
let mut map: VecMap<i32, &str> = VecMap::with_capacity(10);
assert_eq!(map.capacity(), 10);sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of entries in the map, also referred to as its ‘length’.
Examples
use vecmap::VecMap;
let mut a = VecMap::new();
assert_eq!(a.len(), 0);
a.insert(1, "a");
assert_eq!(a.len(), 1);sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map contains no entries.
Examples
use vecmap::VecMap;
let mut a = VecMap::new();
assert!(a.is_empty());
a.insert(1, "a");
assert!(!a.is_empty());sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the map, removing all entries.
Examples
use vecmap::VecMap;
let mut a = VecMap::new();
a.insert(1, "a");
a.clear();
assert!(a.is_empty());sourcepub fn reverse(&mut self)
pub fn reverse(&mut self)
Reverses the order of entries in the map, in place.
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1), ("b", 2), ("c", 3)]);
map.reverse();
assert_eq!(map, VecMap::from_iter([("c", 3), ("b", 2), ("a", 1)]));sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted in the given
VecMap<K, V>. The collection may reserve more space to speculatively avoid frequent
reallocations. After calling reserve, capacity will be greater than or equal to
self.len() + additional. Does nothing if capacity is already sufficient.
Panics
Panics if the new capacity exceeds isize::MAX bytes.
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1)]);
map.reserve(10);
assert!(map.capacity() >= 11);sourceimpl<K, V> VecMap<K, V>
impl<K, V> VecMap<K, V>
sourcepub fn contains_key<Q>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn contains_key<Q>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Q: Eq + ?Sized,
Return true if an equivalent to key exists in the map.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
assert_eq!(map.contains_key(&1), true);
assert_eq!(map.contains_key(&2), false);sourcepub fn first(&self) -> Option<(&K, &V)>
pub fn first(&self) -> Option<(&K, &V)>
Get the first key-value pair.
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1), ("b", 2)]);
assert_eq!(map.first(), Some((&"a", &1)));sourcepub fn first_mut(&mut self) -> Option<(&K, &mut V)>
pub fn first_mut(&mut self) -> Option<(&K, &mut V)>
Get the first key-value pair, with mutable access to the value.
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1), ("b", 2)]);
if let Some((_, v)) = map.first_mut() {
*v = *v + 10;
}
assert_eq!(map.first(), Some((&"a", &11)));sourcepub fn last(&self) -> Option<(&K, &V)>
pub fn last(&self) -> Option<(&K, &V)>
Get the last key-value pair.
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1), ("b", 2)]);
assert_eq!(map.last(), Some((&"b", &2)));
map.pop();
map.pop();
assert_eq!(map.last(), None);sourcepub fn last_mut(&mut self) -> Option<(&K, &mut V)>
pub fn last_mut(&mut self) -> Option<(&K, &mut V)>
Get the last key-value pair, with mutable access to the value.
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([("a", 1), ("b", 2)]);
if let Some((_, v)) = map.last_mut() {
*v = *v + 10;
}
assert_eq!(map.last(), Some((&"b", &12)));sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get<Q>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return a reference to the value stored for key, if it is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
assert_eq!(map.get(&1), Some(&"a"));
assert_eq!(map.get(&2), None);sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return a mutable reference to the value stored for key, if it is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
if let Some(x) = map.get_mut(&1) {
*x = "b";
}
assert_eq!(map[&1], "b");sourcepub fn get_index(&self, index: usize) -> Option<(&K, &V)>
pub fn get_index(&self, index: usize) -> Option<(&K, &V)>
Return references to the key-value pair stored at index, if it is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
assert_eq!(map.get_index(0), Some((&1, &"a")));
assert_eq!(map.get_index(1), None);sourcepub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)>
pub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)>
Return a reference to the key and a mutable reference to the value stored at index, if it
is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
if let Some((_, v)) = map.get_index_mut(0) {
*v = "b";
}
assert_eq!(map[0], "b");sourcepub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return the index and references to the key-value pair stored for key, if it is present,
else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
assert_eq!(map.get_full(&1), Some((0, &1, &"a")));
assert_eq!(map.get_full(&2), None);sourcepub fn get_full_mut<Q>(&mut self, key: &Q) -> Option<(usize, &K, &mut V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get_full_mut<Q>(&mut self, key: &Q) -> Option<(usize, &K, &mut V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return the index, a reference to the key and a mutable reference to the value stored for
key, if it is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
if let Some((_, _, v)) = map.get_full_mut(&1) {
*v = "b";
}
assert_eq!(map.get(&1), Some(&"b"));sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return references to the key-value pair stored for key, if it is present, else None.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert(1, "a");
assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
assert_eq!(map.get_key_value(&2), None);sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Return item index, if it exists in the map.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
map.insert("a", 10);
map.insert("b", 20);
assert_eq!(map.get_index_of("a"), Some(0));
assert_eq!(map.get_index_of("b"), Some(1));
assert_eq!(map.get_index_of("c"), None);sourceimpl<K, V> VecMap<K, V>
impl<K, V> VecMap<K, V>
sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Remove the key-value pair equivalent to key and return its value.
Like Vec::remove, the pair is removed by shifting all of the elements that follow it,
preserving their relative order. This perturbs the index of all of those elements!
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([(1, "a"), (2, "b"), (3, "c"), (4, "d")]);
assert_eq!(map.remove(&2), Some("b"));
assert_eq!(map.remove(&2), None);
assert_eq!(map, VecMap::from_iter([(1, "a"), (3, "c"), (4, "d")]));sourcepub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Remove and return the key-value pair equivalent to key.
Like Vec::remove, the pair is removed by shifting all of the elements that follow it,
preserving their relative order. This perturbs the index of all of those elements!
Examples
use vecmap::VecMap;
let mut map = VecMap::from_iter([(1, "a"), (2, "b"), (3, "c"), (4, "d")]);
assert_eq!(map.remove_entry(&2), Some((2, "b")));
assert_eq!(map.remove_entry(&2), None);
assert_eq!(map, VecMap::from_iter([(1, "a"), (3, "c"), (4, "d")]));sourcepub fn swap_remove<Q>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn swap_remove<Q>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Remove the key-value pair equivalent to key and return its value.
Like Vec::swap_remove, the pair is removed by swapping it with the last element of the
map and popping it off. This perturbs the position of what used to be the last element!
Return None if key is not in map.
use vecmap::VecMap;
let mut map = VecMap::from_iter([(1, "a"), (2, "b"), (3, "c"), (4, "d")]);
assert_eq!(map.swap_remove(&2), Some("b"));
assert_eq!(map.swap_remove(&2), None);
assert_eq!(map, VecMap::from_iter([(1, "a"), (4, "d"), (3, "c")]));sourcepub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
pub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
Q: Eq + ?Sized,
Remove and return the key-value pair equivalent to key.
Like Vec::swap_remove, the pair is removed by swapping it with the last element of the
map and popping it off. This perturbs the position of what used to be the last element!
Return None if key is not in map.
use vecmap::VecMap;
let mut map = VecMap::from_iter([(1, "a"), (2, "b"), (3, "c"), (4, "d")]);
assert_eq!(map.swap_remove_entry(&2), Some((2, "b")));
assert_eq!(map.swap_remove_entry(&2), None);
assert_eq!(map, VecMap::from_iter([(1, "a"), (4, "d"), (3, "c")]));sourceimpl<K, V> VecMap<K, V>where
K: Eq,
impl<K, V> VecMap<K, V>where
K: Eq,
sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Insert a key-value pair in the map.
If an equivalent key already exists in the map: the key remains and retains in its place
in the order, its corresponding value is updated with value and the older value is
returned inside Some(_).
If no equivalent key existed in the map: the new key-value pair is inserted, last in
order, and None is returned.
See also entry if you you want to insert or modify or if you need to
get the index of the corresponding key-value pair.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
assert_eq!(map.insert(37, "a"), None);
assert_eq!(map.is_empty(), false);
map.insert(37, "b");
assert_eq!(map.insert(37, "c"), Some("b"));
assert_eq!(map[&37], "c");sourcepub fn insert_full(&mut self, key: K, value: V) -> (usize, Option<V>)
pub fn insert_full(&mut self, key: K, value: V) -> (usize, Option<V>)
Insert a key-value pair in the map, and get their index.
If an equivalent key already exists in the map: the key remains and
retains in its place in the order, its corresponding value is updated
with value and the older value is returned inside (index, Some(_)).
If no equivalent key existed in the map: the new key-value pair is
inserted, last in order, and (index, None) is returned.
Computes in O(1) time (amortized average).
See also entry if you you want to insert or modify
or if you need to get the index of the corresponding key-value pair.
Examples
use vecmap::VecMap;
let mut map = VecMap::new();
assert_eq!(map.insert_full("a", 1), (0, None));
assert_eq!(map.insert_full("b", 2), (1, None));
assert_eq!(map.insert_full("b", 3), (1, Some(2)));
assert_eq!(map["b"], 3);sourcepub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
Get the given key’s corresponding entry in the map for insertion and/or in-place manipulation.
Examples
use vecmap::VecMap;
let mut letters = VecMap::new();
for ch in "a short treatise on fungi".chars() {
letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1);
}
assert_eq!(letters[&'s'], 2);
assert_eq!(letters[&'t'], 3);
assert_eq!(letters[&'u'], 1);
assert_eq!(letters.get(&'y'), None);sourceimpl<K, V> VecMap<K, V>
impl<K, V> VecMap<K, V>
sourcepub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K, V> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);
pub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K, V> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);
An iterator visiting all key-value pairs in insertion order. The iterator element type is
(&'a K, &'a V).
Examples
use vecmap::VecMap;
let map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for (key, val) in map.iter() {
println!("key: {key} val: {val}");
}sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K, V> Iterator for IterMut<'a, K, V> type Item = (&'a K, &'a mut V);
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K, V> Iterator for IterMut<'a, K, V> type Item = (&'a K, &'a mut V);
An iterator visiting all key-value pairs in insertion order, with mutable references to the
values. The iterator element type is (&'a K, &'a mut V).
Examples
use vecmap::VecMap;
let mut map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
// Update all values
for (_, val) in map.iter_mut() {
*val *= 2;
}
for (key, val) in &map {
println!("key: {key} val: {val}");
}sourcepub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K, V> Iterator for Keys<'a, K, V> type Item = &'a K;
pub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K, V> Iterator for Keys<'a, K, V> type Item = &'a K;
An iterator visiting all keys in insertion order. The iterator element type is &'a K.
Examples
use vecmap::VecMap;
let map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for key in map.keys() {
println!("{key}");
}sourcepub fn into_keys(self) -> IntoKeys<K, V>ⓘNotable traits for IntoKeys<K, V>impl<K, V> Iterator for IntoKeys<K, V> type Item = K;
pub fn into_keys(self) -> IntoKeys<K, V>ⓘNotable traits for IntoKeys<K, V>impl<K, V> Iterator for IntoKeys<K, V> type Item = K;
Creates a consuming iterator visiting all the keys in insertion order. The object cannot be
used after calling this. The iterator element type is K.
Examples
use vecmap::VecMap;
let map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
let mut vec: Vec<&str> = map.into_keys().collect();
assert_eq!(vec, ["a", "b", "c"]);sourcepub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K, V> Iterator for Values<'a, K, V> type Item = &'a V;
pub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K, V> Iterator for Values<'a, K, V> type Item = &'a V;
An iterator visiting all values in insertion order. The iterator element type is &'a V.
Examples
use vecmap::VecMap;
let map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for val in map.values() {
println!("{val}");
}sourcepub fn values_mut(&mut self) -> ValuesMut<'_, K, V>ⓘNotable traits for ValuesMut<'a, K, V>impl<'a, K, V> Iterator for ValuesMut<'a, K, V> type Item = &'a mut V;
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>ⓘNotable traits for ValuesMut<'a, K, V>impl<'a, K, V> Iterator for ValuesMut<'a, K, V> type Item = &'a mut V;
An iterator visiting all values mutably in insertion order. The iterator element type is
&'a mut V.
Examples
use vecmap::VecMap;
let mut map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for val in map.values_mut() {
*val = *val + 10;
}
for val in map.values() {
println!("{val}");
}sourcepub fn into_values(self) -> IntoValues<K, V>ⓘNotable traits for IntoValues<K, V>impl<K, V> Iterator for IntoValues<K, V> type Item = V;
pub fn into_values(self) -> IntoValues<K, V>ⓘNotable traits for IntoValues<K, V>impl<K, V> Iterator for IntoValues<K, V> type Item = V;
Creates a consuming iterator visiting all the values in insertion order. The object cannot
be used after calling this. The iterator element type is V.
Examples
use vecmap::VecMap;
let map = VecMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
let mut vec: Vec<i32> = map.into_values().collect();
assert_eq!(vec, [1, 2, 3]);Trait Implementations
sourceimpl<'de, K, V> Deserialize<'de> for VecMap<K, V>where
K: Deserialize<'de> + Eq,
V: Deserialize<'de>,
impl<'de, K, V> Deserialize<'de> for VecMap<K, V>where
K: Deserialize<'de> + Eq,
V: Deserialize<'de>,
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a, K, V> Extend<(&'a K, &'a V)> for VecMap<K, V>where
K: Copy + Eq,
V: Copy,
impl<'a, K, V> Extend<(&'a K, &'a V)> for VecMap<K, V>where
K: Copy + Eq,
V: Copy,
sourcefn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = (&'a K, &'a V)>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = (&'a K, &'a V)>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<K, V> Extend<(K, V)> for VecMap<K, V>where
K: Eq,
impl<K, V> Extend<(K, V)> for VecMap<K, V>where
K: Eq,
sourcefn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = (K, V)>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = (K, V)>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<K, V> FromIterator<(K, V)> for VecMap<K, V>where
K: Eq,
impl<K, V> FromIterator<(K, V)> for VecMap<K, V>where
K: Eq,
sourcefn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = (K, V)>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = (K, V)>,
Creates a value from an iterator. Read more
sourceimpl<'de, K, V, E> IntoDeserializer<'de, E> for VecMap<K, V>where
K: IntoDeserializer<'de, E> + Eq,
V: IntoDeserializer<'de, E>,
E: Error,
impl<'de, K, V, E> IntoDeserializer<'de, E> for VecMap<K, V>where
K: IntoDeserializer<'de, E> + Eq,
V: IntoDeserializer<'de, E>,
E: Error,
type Deserializer = MapDeserializer<'de, <VecMap<K, V> as IntoIterator>::IntoIter, E>
type Deserializer = MapDeserializer<'de, <VecMap<K, V> as IntoIterator>::IntoIter, E>
The type of the deserializer being converted into.
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
sourceimpl<'a, K, V> IntoIterator for &'a VecMap<K, V>
impl<'a, K, V> IntoIterator for &'a VecMap<K, V>
sourceimpl<'a, K, V> IntoIterator for &'a mut VecMap<K, V>
impl<'a, K, V> IntoIterator for &'a mut VecMap<K, V>
sourceimpl<K, V> IntoIterator for VecMap<K, V>
impl<K, V> IntoIterator for VecMap<K, V>
sourceimpl<K: Ord, V: Ord> Ord for VecMap<K, V>
impl<K: Ord, V: Ord> Ord for VecMap<K, V>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<K: PartialEq, V: PartialEq> PartialEq<VecMap<K, V>> for VecMap<K, V>
impl<K: PartialEq, V: PartialEq> PartialEq<VecMap<K, V>> for VecMap<K, V>
sourceimpl<K: PartialOrd, V: PartialOrd> PartialOrd<VecMap<K, V>> for VecMap<K, V>
impl<K: PartialOrd, V: PartialOrd> PartialOrd<VecMap<K, V>> for VecMap<K, V>
sourcefn partial_cmp(&self, other: &VecMap<K, V>) -> Option<Ordering>
fn partial_cmp(&self, other: &VecMap<K, V>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<K: Eq, V: Eq> Eq for VecMap<K, V>
impl<K, V> StructuralEq for VecMap<K, V>
impl<K, V> StructuralPartialEq for VecMap<K, V>
Auto Trait Implementations
impl<K, V> RefUnwindSafe for VecMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for VecMap<K, V>where
K: Send,
V: Send,
impl<K, V> Sync for VecMap<K, V>where
K: Sync,
V: Sync,
impl<K, V> Unpin for VecMap<K, V>where
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for VecMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more