Struct serde_json::Map [−][src]
Represents a JSON key/value type.
Methods
impl Map<String, Value>
[src]
[−]
impl Map<String, Value>
pub fn new() -> Self
[src]
[−]
pub fn new() -> Self
Makes a new empty Map.
pub fn with_capacity(capacity: usize) -> Self
[src]
[−]
pub fn with_capacity(capacity: usize) -> Self
Makes a new empty Map with the given initial capacity.
pub fn clear(&mut self)
[src]
[−]
pub fn clear(&mut self)
Clears the map, removing all values.
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[−]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
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
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[−]
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
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 Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[−]
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
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: String, v: Value) -> Option<Value>
[src]
[−]
pub fn insert(&mut self, k: String, v: Value) -> Option<Value>
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.
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[−]
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
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 where
S: Into<String>,
[src]
[−]
pub fn entry<S>(&mut self, key: S) -> Entry where
S: Into<String>,
Gets the given key's corresponding entry in the map for in-place manipulation.
pub fn len(&self) -> usize
[src]
[−]
pub fn len(&self) -> usize
Returns the number of elements in the map.
pub fn is_empty(&self) -> bool
[src]
[−]
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
ⓘImportant traits for Iter<'a>pub fn iter(&self) -> Iter
[src]
[−]
pub fn iter(&self) -> Iter
Gets an iterator over the entries of the map.
ⓘImportant traits for IterMut<'a>pub fn iter_mut(&mut self) -> IterMut
[src]
[−]
pub fn iter_mut(&mut self) -> IterMut
Gets a mutable iterator over the entries of the map.
ⓘImportant traits for Keys<'a>pub fn keys(&self) -> Keys
[src]
[−]
pub fn keys(&self) -> Keys
Gets an iterator over the keys of the map.
ⓘImportant traits for Values<'a>pub fn values(&self) -> Values
[src]
[−]
pub fn values(&self) -> Values
Gets an iterator over the values of the map.
ⓘImportant traits for ValuesMut<'a>pub fn values_mut(&mut self) -> ValuesMut
[src]
[−]
pub fn values_mut(&mut self) -> ValuesMut
Gets an iterator over mutable values of the map.
Trait Implementations
impl Default for Map<String, Value>
[src]
[+]
impl Default for Map<String, Value>
impl Clone for Map<String, Value>
[src]
[+]
impl Clone for Map<String, Value>
impl PartialEq for Map<String, Value>
[src]
[+]
impl PartialEq for Map<String, Value>
impl<'a, Q: ?Sized> Index<&'a Q> for Map<String, Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[+]
impl<'a, Q: ?Sized> Index<&'a Q> for Map<String, Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
impl<'a, Q: ?Sized> IndexMut<&'a Q> for Map<String, Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
[src]
[+]
impl<'a, Q: ?Sized> IndexMut<&'a Q> for Map<String, Value> where
String: Borrow<Q>,
Q: Ord + Eq + Hash,
impl Debug for Map<String, Value>
[src]
[+]
impl Debug for Map<String, Value>
impl Serialize for Map<String, Value>
[src]
[+]
impl Serialize for Map<String, Value>
impl<'de> Deserialize<'de> for Map<String, Value>
[src]
[+]
impl<'de> Deserialize<'de> for Map<String, Value>
impl FromIterator<(String, Value)> for Map<String, Value>
[src]
[+]
impl FromIterator<(String, Value)> for Map<String, Value>
impl Extend<(String, Value)> for Map<String, Value>
[src]
[+]
impl Extend<(String, Value)> for Map<String, Value>
impl<'a> IntoIterator for &'a Map<String, Value>
[src]
[+]
impl<'a> IntoIterator for &'a Map<String, Value>
impl<'a> IntoIterator for &'a mut Map<String, Value>
[src]
[+]
impl<'a> IntoIterator for &'a mut Map<String, Value>
impl IntoIterator for Map<String, Value>
[src]
[+]
impl IntoIterator for Map<String, Value>
impl From<Map<String, Value>> for Value
[src]
[+]
impl From<Map<String, Value>> for Value