[][src]Struct serde_json::Map

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.

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.

Important traits for Iter<'a>

Gets an iterator over the entries of the map.

Important traits for IterMut<'a>

Gets a mutable iterator over the entries of the map.

Important traits for Keys<'a>

Gets an iterator over the keys of the map.

Important traits for Values<'a>

Gets an iterator over the values of the map.

Important traits for ValuesMut<'a>

Gets an iterator over mutable values of the map.

Trait Implementations

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

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

This method tests for !=.

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

Convert map (with string keys) to Value

Examples

use serde_json::{Map, Value};

let mut m = Map::new();
m.insert("Lorem".to_string(), "ipsum".into());
let x: Value = m.into();

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

Performs copy-assignment from source. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

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

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

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

# use serde_json::Value;
#
# let val = &Value::String("".to_owned());
# let _ =
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,
}
# ;

The returned type after indexing.

impl<'a, Q: ?Sized> IndexMut<&'a Q> for Map<String, Value> where
    String: 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.

# use serde_json::json;
#
# let mut map = serde_json::Map::new();
# map.insert("key".to_owned(), serde_json::Value::Null);
#
map["key"] = json!("value");

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

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

impl<'de> Deserialize<'de> for Map<String, Value>
[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

Blanket Implementations

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

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

impl<T> From for T
[src]

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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