pub struct Map<K, V> { /* private fields */ }
Expand description
Represents a JSON key/value type.
Implementations§
Source§impl Map<String, Value>
impl Map<String, Value>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Makes a new empty Map with the given initial capacity.
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&Value>
pub fn get<Q>(&self, key: &Q) -> Option<&Value>
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.
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
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.
Sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
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.
Sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&String, &Value)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&String, &Value)>
Returns the key-value pair matching the given 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.
Sourcepub fn insert(&mut self, k: String, v: Value) -> Option<Value>
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.
Sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<Value>
pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>
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.
If serde_json’s “preserve_order” is enabled, .remove(key)
is
equivalent to [.swap_remove(key)
][Self::swap_remove], replacing this
entry’s position with the last element. If you need to preserve the
relative order of the keys in the map, use
[.shift_remove(key)
][Self::shift_remove] instead.
Sourcepub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)>
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)>
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.
If serde_json’s “preserve_order” is enabled, .remove_entry(key)
is
equivalent to [.swap_remove_entry(key)
][Self::swap_remove_entry],
replacing this entry’s position with the last element. If you need to
preserve the relative order of the keys in the map, use
[.shift_remove_entry(key)
][Self::shift_remove_entry] instead.
Sourcepub fn append(&mut self, other: &mut Self)
pub fn append(&mut self, other: &mut Self)
Moves all elements from other into self, leaving other empty.
Sourcepub fn entry<S>(&mut self, key: S) -> Entry<'_>
pub fn entry<S>(&mut self, key: S) -> Entry<'_>
Gets the given key’s corresponding entry in the map for in-place manipulation.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_> ⓘ
Gets a mutable iterator over the entries of the map.
Sourcepub fn values_mut(&mut self) -> ValuesMut<'_> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_> ⓘ
Gets an iterator over mutable values of the map.
Sourcepub fn retain<F>(&mut self, f: F)
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
In other words, remove all pairs (k, v)
such that f(&k, &mut v)
returns false
.
Sourcepub fn sort_keys(&mut self)
pub fn sort_keys(&mut self)
Sorts this map’s entries in-place using str
’s usual ordering.
If serde_json’s “preserve_order” feature is not enabled, this method does no work because all JSON maps are always kept in a sorted state.
If serde_json’s “preserve_order” feature is enabled, this method destroys the original source order or insertion order of this map in favor of an alphanumerical order that matches how a BTreeMap with the same contents would be ordered. This takes O(n log n + c) time where n is the length of the map and c is the capacity.
Other maps nested within the values of this map are not sorted. If you
need the entire data structure to be sorted at all levels, you must also
call
map.values_mut().for_each(Value::sort_all_objects)
.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Map<String, Value>
impl<'de> Deserialize<'de> for Map<String, Value>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserializer<'de> for &'de Map<String, Value>
impl<'de> Deserializer<'de> for &'de Map<String, Value>
Source§type Error = Error
type Error = Error
Source§fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read moreSource§fn deserialize_enum<V>(
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an enum value with a
particular name and possible variants.Source§fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Error>where
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Error>where
V: Visitor<'de>,
Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read moreSource§fn deserialize_bool<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_bool<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a bool
value.Source§fn deserialize_i8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i8
value.Source§fn deserialize_i16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i16
value.Source§fn deserialize_i32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i32
value.Source§fn deserialize_i64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i64
value.Source§fn deserialize_i128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Source§fn deserialize_u8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u8
value.Source§fn deserialize_u16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u16
value.Source§fn deserialize_u32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u32
value.Source§fn deserialize_u64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u64
value.Source§fn deserialize_u128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Source§fn deserialize_f32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_f32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f32
value.Source§fn deserialize_f64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_f64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f64
value.Source§fn deserialize_char<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_char<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a char
value.Source§fn deserialize_str<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_str<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_string<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_string<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_bytes<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_bytes<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_byte_buf<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_byte_buf<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_option<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_option<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an optional value. Read moreSource§fn deserialize_unit<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_unit<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit value.Source§fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit struct with a
particular name.Source§fn deserialize_newtype_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a newtype struct with a
particular name.Source§fn deserialize_seq<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_seq<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values.Source§fn deserialize_tuple<V>(
self,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data.Source§fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a tuple struct with a
particular name and number of fields.Source§fn deserialize_map<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_map<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a map of key-value pairs.Source§fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a struct with a particular
name and fields.Source§fn deserialize_identifier<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_identifier<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant.Source§fn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Deserialize
implementations should expect to
deserialize their human-readable form. Read moreSource§impl<'de> Deserializer<'de> for Map<String, Value>
impl<'de> Deserializer<'de> for Map<String, Value>
Source§type Error = Error
type Error = Error
Source§fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read moreSource§fn deserialize_enum<V>(
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
_name: &'static str,
_variants: &'static [&'static str],
visitor: V,
) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an enum value with a
particular name and possible variants.Source§fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>where
V: Visitor<'de>,
Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read moreSource§fn deserialize_bool<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_bool<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a bool
value.Source§fn deserialize_i8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i8
value.Source§fn deserialize_i16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i16
value.Source§fn deserialize_i32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i32
value.Source§fn deserialize_i64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an i64
value.Source§fn deserialize_i128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_i128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Source§fn deserialize_u8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u8<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u8
value.Source§fn deserialize_u16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u16<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u16
value.Source§fn deserialize_u32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u32
value.Source§fn deserialize_u64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a u64
value.Source§fn deserialize_u128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_u128<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Source§fn deserialize_f32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_f32<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f32
value.Source§fn deserialize_f64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_f64<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a f64
value.Source§fn deserialize_char<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_char<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a char
value.Source§fn deserialize_str<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_str<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_string<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_string<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_bytes<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_bytes<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_byte_buf<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_byte_buf<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read moreSource§fn deserialize_option<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_option<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting an optional value. Read moreSource§fn deserialize_unit<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_unit<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit value.Source§fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a unit struct with a
particular name.Source§fn deserialize_newtype_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
name: &'static str,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a newtype struct with a
particular name.Source§fn deserialize_seq<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_seq<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values.Source§fn deserialize_tuple<V>(
self,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data.Source§fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a tuple struct with a
particular name and number of fields.Source§fn deserialize_map<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_map<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a map of key-value pairs.Source§fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting a struct with a particular
name and fields.Source§fn deserialize_identifier<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
fn deserialize_identifier<V>(
self,
visitor: V,
) -> Result<V::Value, <Self as Deserializer<'de>>::Error>where
V: Visitor<'de>,
Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant.Source§fn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Deserialize
implementations should expect to
deserialize their human-readable form. Read moreSource§impl Extend<(String, Value)> for Map<String, Value>
impl Extend<(String, Value)> for Map<String, Value>
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<Q> Index<&Q> for Map<String, Value>
impl<Q> Index<&Q> for Map<String, Value>
Access an element of this map. Panics if the given key is not present in the map.
match val {
Value::String(s) => Some(s.as_str()),
Value::Array(arr) => arr[0].as_str(),
Value::Object(map) => map["type"].as_str(),
_ => None,
}
Source§impl<Q> IndexMut<&Q> for Map<String, Value>
impl<Q> IndexMut<&Q> for Map<String, Value>
Mutably access an element of this map. Panics if the given key is not present in the map.
map["key"] = json!("value");
Source§impl<'de> IntoDeserializer<'de, Error> for &'de Map<String, Value>
impl<'de> IntoDeserializer<'de, Error> for &'de Map<String, Value>
Source§type Deserializer = &'de Map<String, Value>
type Deserializer = &'de Map<String, Value>
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Source§impl<'de> IntoDeserializer<'de, Error> for Map<String, Value>
impl<'de> IntoDeserializer<'de, Error> for Map<String, Value>
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
impl Eq for Map<String, Value>
Auto Trait Implementations§
impl<K, V> Freeze for Map<K, V>
impl<K, V> RefUnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V>
impl<K, V> Sync for Map<K, V>
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes