Struct reqwest_dav::re_exports::serde_json::map::Map
source · [−]pub struct Map<K, V> { /* private fields */ }
Expand description
Represents a JSON key/value type.
Implementations
sourceimpl Map<String, Value>
impl Map<String, Value>
sourcepub fn with_capacity(capacity: usize) -> Map<String, Value>
pub fn with_capacity(capacity: usize) -> Map<String, Value>
Makes a new empty Map with the given initial capacity.
sourcepub fn get<Q>(&self, key: &Q) -> Option<&Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn get<Q>(&self, key: &Q) -> Option<&Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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) -> boolwhere
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn contains_key<Q>(&self, key: &Q) -> boolwhere
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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)>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&String, &Value)>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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.
sourcepub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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.
sourcepub fn append(&mut self, other: &mut Map<String, Value>)
pub fn append(&mut self, other: &mut Map<String, Value>)
Moves all elements from other into self, leaving other empty.
sourcepub fn entry<S>(&mut self, key: S) -> Entry<'_>where
S: Into<String>,
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.
sourcepub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>impl<'a> Iterator for Iter<'a> type Item = (&'a String, &'a Value);
pub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>impl<'a> Iterator for Iter<'a> type Item = (&'a String, &'a Value);
Gets an iterator over the entries of the map.
sourcepub fn iter_mut(&mut self) -> IterMut<'_>ⓘNotable traits for IterMut<'a>impl<'a> Iterator for IterMut<'a> type Item = (&'a String, &'a mut Value);
pub fn iter_mut(&mut self) -> IterMut<'_>ⓘNotable traits for IterMut<'a>impl<'a> Iterator for IterMut<'a> type Item = (&'a String, &'a mut Value);
Gets a mutable iterator over the entries of the map.
sourcepub fn keys(&self) -> Keys<'_>ⓘNotable traits for Keys<'a>impl<'a> Iterator for Keys<'a> type Item = &'a String;
pub fn keys(&self) -> Keys<'_>ⓘNotable traits for Keys<'a>impl<'a> Iterator for Keys<'a> type Item = &'a String;
Gets an iterator over the keys of the map.
sourcepub fn values(&self) -> Values<'_>ⓘNotable traits for Values<'a>impl<'a> Iterator for Values<'a> type Item = &'a Value;
pub fn values(&self) -> Values<'_>ⓘNotable traits for Values<'a>impl<'a> Iterator for Values<'a> type Item = &'a Value;
Gets an iterator over the values of the map.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Map<String, Value>
impl<'de> Deserialize<'de> for Map<String, Value>
sourcefn deserialize<D>(
deserializer: D
) -> Result<Map<String, Value>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Map<String, Value>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Extend<(String, Value)> for Map<String, Value>
impl Extend<(String, Value)> for Map<String, Value>
sourcefn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (String, Value)>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (String, Value)>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<'a, Q> Index<&'a Q> for Map<String, Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
impl<'a, Q> Index<&'a Q> for Map<String, Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
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,
}
sourceimpl<'a, Q> IndexMut<&'a Q> for Map<String, Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
impl<'a, Q> IndexMut<&'a Q> for Map<String, Value>where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
Mutably access an element of this map. Panics if the given key is not present in the map.
map["key"] = json!("value");
sourceimpl<'a> IntoIterator for &'a Map<String, Value>
impl<'a> IntoIterator for &'a Map<String, Value>
sourceimpl<'a> IntoIterator for &'a mut Map<String, Value>
impl<'a> IntoIterator for &'a mut Map<String, Value>
sourceimpl IntoIterator for Map<String, Value>
impl IntoIterator for Map<String, Value>
sourceimpl PartialEq<Map<String, Value>> for Map<String, Value>
impl PartialEq<Map<String, Value>> for Map<String, Value>
sourceimpl Serialize for Map<String, Value>
impl Serialize for Map<String, Value>
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Map<String, Value>
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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,
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more