Struct serde_json::map::Map [−][src]
pub struct Map<K, V> { /* fields omitted */ }
Expand description
Represents a JSON key/value type.
Implementations
Makes a new empty Map with the given initial capacity.
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.
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.
Removes a key from the map, returning the stored key and value 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.
Moves all elements from other into Self, leaving other empty.
Gets the given key’s corresponding entry in the map for in-place manipulation.
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
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
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,
}
Mutably access an element of this map. Panics if the given key is not present in the map.
map["key"] = json!("value");
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Map<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> UnwindSafe for Map<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more