Struct VecMap Copy item path Source pub struct VecMap<K: Eq , V: Sized + PartialEq > { }Expand description A map type backed by a Vector. Useful for small collections whose size can change.
Creates a new, empty VecMap.
Calls Vec::new() internally.
Please only use this method to create map literals if the “macros” feature is unavailable to you
“macros” provides safe, checked alternatives to initialize linear maps with compile time checking
of the invariants of each type.
Creates a new VecMap from the supplied vector.
SAFETY: improper use of this method - initializing with duplicate keys - will NOT create memory unsafety, but will result in every
identical key beyond the first never getting accessed as LinearMaps short circuit on the first matching key.
Returns the number of elements in the container
Returns true if the store is empty, false otherwise.
Creates a new, empty VecMap with capacity set to the provide value.
Calls Vec::with_capacity() internally.
Tries to remove the value associated with the given key, returning None if it is not found.
Tries to remove the entry associated with the given key, returning None if it is not found.
Inserts the provided value into the VecMap. If the provided key is
found it will update the value. and return the old value. If not, this will allocate for a new key value pair.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Returns the “default value” for a type.
Read more The keys and values of the map.
Consumes self, returning the underlying store.
Returns true if this map contains the given key. False otherwise.
Returns true if this map contains a given value. False otherwise.
Gets a reference with the associated key. Will return None if that i
key is not in the map.
Gets a mutable reference with the associated key. Will return None if that
key is not in the map.
Gets a reference to the nth value in the map.
Will return None if index is out of bounds.
Gets a reference to the nth value in the map.
Will return None if index is out of bounds.
Gets a reference to the nth value in the map.
Will return None if index is out of bounds.
Gets a reference to the nth key in the map.
Will return None if index is out of bounds.
Searches for a key == key in the map. If it is present
replaces its value with “value”. If not, it does nothing.
For every key in iter which matches a key in self, this method replaces
the value from iter in self, “merging” the iterator and the map.
Read more Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.