[][src]Struct toml_spanned_value::spanned_value::Map

pub struct Map<K: Ord + Hash, V> { /* fields omitted */ }

Represents a JSON key/value type.

Methods

impl<K: Ord + Hash, V> Map<K, V>[src]

pub fn new() -> Self[src]

Makes a new empty Map.

pub fn with_capacity(capacity: usize) -> Self[src]

Makes a new empty Map with the given initial capacity.

pub fn clear(&mut self)[src]

Clears the map, removing all values.

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Returns 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.

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Returns 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.

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Returns 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.

pub fn insert(&mut self, k: K, v: V) -> Option<V>[src]

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. The key is not updated, though; this matters for types that can be == without being identical.

pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where
    K: Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Removes 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.

pub fn entry<S>(&mut self, key: S) -> Entry<K, V> where
    S: Into<K>, 
[src]

Gets the given key's corresponding entry in the map for in-place manipulation.

pub fn len(&self) -> usize[src]

Returns the number of elements in the map.

pub fn is_empty(&self) -> bool[src]

Returns true if the map contains no elements.

pub fn iter(&self) -> Iter<K, V>[src]

Gets an iterator over the entries of the map.

pub fn iter_mut(&mut self) -> IterMut<K, V>[src]

Gets a mutable iterator over the entries of the map.

pub fn keys(&self) -> Keys<K, V>[src]

Gets an iterator over the keys of the map.

pub fn values(&self) -> Values<K, V>[src]

Gets an iterator over the values of the map.

Trait Implementations

impl From<Map<Spanned<String>, Spanned<ValueKind>>> for ValueKind[src]

impl<K: Ord + Hash, V> Extend<(K, V)> for Map<K, V>[src]

impl<'a, K: Ord + Hash, V> IntoIterator for &'a Map<K, V>[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

impl<'a, K: Ord + Hash, V> IntoIterator for &'a mut Map<K, V>[src]

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.

type IntoIter = IterMut<'a, K, V>

Which kind of iterator are we turning this into?

impl<K: Ord + Hash, V> IntoIterator for Map<K, V>[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?

impl<K: Clone + Ord + Hash, V: Clone> Clone for Map<K, V>[src]

impl<K: Ord + Hash, V> Default for Map<K, V>[src]

impl<K: PartialEq + Ord + Hash, V: PartialEq> PartialEq<Map<K, V>> for Map<K, V>[src]

impl<K: Ord + Hash + Debug, V: Debug> Debug for Map<K, V>[src]

impl<'a, K, V, Q: ?Sized> Index<&'a Q> for Map<K, V> where
    K: Ord + Hash + Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Access an element of this map. Panics if the given key is not present in the map.

type Output = V

The returned type after indexing.

impl<'a, K, V, Q: ?Sized> IndexMut<&'a Q> for Map<K, V> where
    K: Ord + Hash + Borrow<Q>,
    Q: Ord + Eq + Hash
[src]

Mutably access an element of this map. Panics if the given key is not present in the map.

impl<K: Ord + Hash, V> StructuralPartialEq for Map<K, V>[src]

impl<K: Ord + Hash, V> FromIterator<(K, V)> for Map<K, V>[src]

impl<K: Ord + Hash + Serialize, V: Serialize> Serialize for Map<K, V>[src]

impl<'de, K, V> Deserialize<'de> for Map<K, V> where
    K: Ord + Hash + Deserialize<'de>,
    V: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<K, V> Send for Map<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Map<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Map<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Map<K, V> where
    K: RefUnwindSafe + UnwindSafe,
    V: RefUnwindSafe + UnwindSafe

impl<K, V> RefUnwindSafe for Map<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]