Struct Map
struct Map<K, V> { ... }
Represents a TOML key/value type.
Implementations
impl Map<String, Value>
fn try_from<T>(value: T) -> Result<Self, crate::ser::Error> where T: ser::SerializeConvert a
Tintotoml::Table.This conversion can fail if
T's implementation ofSerializedecides to fail, or ifTcontains a map with non-string keys.fn try_into<'de, T>(self: Self) -> Result<T, crate::de::Error> where T: de::Deserialize<'de>Interpret a
toml::Tableas an instance of typeT.This conversion can fail if the structure of the
Tabledoes not match the structure expected byT, for example ifTis a bool which can't be mapped to aTable. It can also fail if the structure is correct butT's implementation ofDeserializedecides that something is wrong with the data, for example required struct fields are missing from the TOML map or some number is too big to fit in the expected primitive type.
impl<'i> Map<Spanned<Cow<'i, str>>, Spanned<DeValue<'i>>>
fn parse(input: &'i str) -> Result<Spanned<Self>, crate::de::Error>Parse a TOML document
fn parse_recoverable(input: &'i str) -> (Spanned<Self>, Vec<crate::de::Error>)Parse a TOML document, with best effort recovery on error
fn make_owned(self: &mut Self)Ensure no data is borrowed
impl<K, V> Map<K, V>
fn new() -> SelfMakes a new empty Map.
fn with_capacity(capacity: usize) -> SelfMakes a new empty Map with the given initial capacity.
fn clear(self: &mut Self)Clears the map, removing all values.
fn get<Q>(self: &Self, key: &Q) -> Option<&V> where K: Borrow<Q>, Q: Ord + Eq + Hash + ?SizedReturns a reference to the value corresponding to the key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
fn contains_key<Q>(self: &Self, key: &Q) -> bool where K: Borrow<Q>, Q: Ord + Eq + Hash + ?SizedReturns true if the map contains a value for the specified key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
fn get_mut<Q>(self: &mut Self, key: &Q) -> Option<&mut V> where K: Borrow<Q>, Q: Ord + Eq + Hash + ?SizedReturns a mutable reference to the value corresponding to the key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
fn get_key_value<Q>(self: &Self, key: &Q) -> Option<(&K, &V)> where K: Borrow<Q>, Q: ?Sized + Ord + Eq + HashReturns the key-value pair matching the given key.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
fn insert(self: &mut Self, k: K, v: V) -> Option<V>Inserts a key-value pair into the map.
If the map did not have this key present,
Noneis returned.If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be
==without being identical.fn remove<Q>(self: &mut Self, key: &Q) -> Option<V> where K: Borrow<Q>, Q: Ord + Eq + Hash + ?SizedRemoves a key from the map, returning the value at the key if the key was previously in the map.
The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
fn remove_entry<Q>(self: &mut Self, key: &Q) -> Option<(K, V)> where K: Borrow<Q>, Q: Ord + Eq + Hash + ?SizedRemoves a key from the map, returning the stored key and value if the key was previously in the map.
fn retain<F>(self: &mut Self, keep: F) where K: AsRef<str>, F: FnMut(&str, &mut V) -> boolRetains only the elements specified by the
keeppredicate.In other words, remove all pairs
(k, v)for whichkeep(&k, &mut v)returnsfalse.The elements are visited in iteration order.
fn entry<S>(self: &mut Self, key: S) -> Entry<'_, K, V> where S: Into<K>Gets the given key's corresponding entry in the map for in-place manipulation.
fn len(self: &Self) -> usizeReturns the number of elements in the map.
fn is_empty(self: &Self) -> boolReturns true if the map contains no elements.
fn iter(self: &Self) -> Iter<'_, K, V>Gets an iterator over the entries of the map.
fn iter_mut(self: &mut Self) -> IterMut<'_, K, V>Gets a mutable iterator over the entries of the map.
fn keys(self: &Self) -> Keys<'_, K, V>Gets an iterator over the keys of the map.
fn values(self: &Self) -> Values<'_, K, V>Gets an iterator over the values of the map.
impl<K, V> Default for Map<K, V>
fn default() -> Self
impl<K, V> Freeze for Map<K, V>
impl<K, V> IntoIterator for Map<K, V>
fn into_iter(self: Self) -> <Self as >::IntoIter
impl<K, V> RefUnwindSafe for Map<K, V>
impl<K, V> Send for Map<K, V>
impl<K, V> Sync for Map<K, V>
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>
impl<K, V, Q> Index for Map<K, V>
fn index(self: &Self, index: &Q) -> &V
impl<K, V, Q> IndexMut for Map<K, V>
fn index_mut(self: &mut Self, index: &Q) -> &mut V
impl<K: Clone, V: Clone> Clone for Map<K, V>
fn clone(self: &Self) -> Self
impl<K: Debug, V: Debug> Debug for Map<K, V>
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error>
impl<K: Eq + Hash, V: PartialEq> PartialEq for Map<K, V>
fn eq(self: &Self, other: &Self) -> bool
impl<K: Ord + Hash, V> Extend for Map<K, V>
fn extend<T>(self: &mut Self, iter: T) where T: IntoIterator<Item = (K, V)>
impl<K: Ord + Hash, V> FromIterator for Map<K, V>
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item = (K, V)>
impl<T> Any for Map<K, V>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Map<K, V>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Map<K, V>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Map<K, V>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> DeserializeOwned for Map<K, V>
impl<T> From for Map<K, V>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Map<K, V>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Map<K, V>
fn to_string(self: &Self) -> String
impl<T, U> Into for Map<K, V>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Map<K, V>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Map<K, V>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>