Struct serde_mcf::Map [] [src]

pub struct Map<K, V> { /* fields omitted */ }

Represents a JSON key/value type.

Methods

impl Map<String, Value>
[src]

Makes a new empty Map.

Makes a new empty Map with the given initial capacity.

Clears the map, removing all values.

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.

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.

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.

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.

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.

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

Returns the number of elements in the map.

Returns true if the map contains no elements.

Gets an iterator over the entries of the map.

Gets a mutable iterator over the entries of the map.

Gets an iterator over the keys of the map.

Gets an iterator over the values of the map.

Trait Implementations

impl<'a> IntoIterator for &'a Map<String, Value>
[src]

impl IntoIterator for Map<String, Value>
[src]

impl<'a> IntoIterator for &'a mut Map<String, Value>
[src]

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

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

map["key"] = json!("value");

impl Debug for Map<String, Value>
[src]

Formats the value using the given formatter.

impl FromIterator<(String, Value)> for Map<String, Value>
[src]

impl Default for Map<String, Value>
[src]

impl Serialize for Map<String, Value>
[src]

Serialize this value into the given Serde serializer. Read more

impl Clone for Map<String, Value>
[src]

impl<'de> Deserialize<'de> for Map<String, Value>
[src]

Deserialize this value from the given Serde deserializer. Read more

impl PartialEq<Map<String, Value>> for Map<String, Value>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Extend<(String, Value)> for Map<String, Value>
[src]

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

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

match *val {
    Value::String(ref s) => Some(s.as_str()),
    Value::Array(ref arr) => arr[0].as_str(),
    Value::Object(ref map) => map["type"].as_str(),
    _ => None,
}