Struct tera::Map [−][src]
pub struct Map<K, V> { /* fields omitted */ }
Expand description
Re-export Value and other useful things from serde so apps/tools can encode data in Tera types Represents a JSON key/value type.
Implementations
impl Map<String, Value>
[src]
impl Map<String, Value>
[src]Re-export Value and other useful things from serde so apps/tools can encode data in Tera types
pub fn with_capacity(capacity: usize) -> Map<String, Value>
[src]
pub fn with_capacity(capacity: usize) -> Map<String, Value>
[src]Makes a new empty Map with the given initial capacity.
pub fn get<Q>(&self, key: &Q) -> Option<&Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
pub fn get<Q>(&self, key: &Q) -> Option<&Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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>(&self, key: &Q) -> bool where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
pub fn contains_key<Q>(&self, key: &Q) -> bool where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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>(&mut self, key: &Q) -> Option<&mut Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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>
[src]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>(&mut self, key: &Q) -> Option<Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
pub fn remove<Q>(&mut self, key: &Q) -> Option<Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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 remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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.
pub fn append(&mut self, other: &mut Map<String, Value>)
[src]
pub fn append(&mut self, other: &mut Map<String, Value>)
[src]Moves all elements from other into Self, leaving other empty.
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>,
[src]Gets the given key’s corresponding entry in the map for in-place manipulation.
pub fn values_mut(&mut self) -> ValuesMut<'_>
[src]
pub fn values_mut(&mut self) -> ValuesMut<'_>
[src]Gets an iterator over mutable values of the map.
Trait Implementations
impl<'de> Deserialize<'de> for Map<String, Value>
[src]
impl<'de> Deserialize<'de> for Map<String, Value>
[src]pub fn deserialize<D>(
deserializer: D
) -> Result<Map<String, Value>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<Map<String, Value>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Extend<(String, Value)> for Map<String, Value>
[src]
impl Extend<(String, Value)> for Map<String, Value>
[src]pub fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = (String, Value)>,
[src]
pub fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = (String, Value)>,
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<'a, Q> Index<&'a Q> for Map<String, Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
impl<'a, Q> Index<&'a Q> for Map<String, Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]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, }
impl<'a, Q> IndexMut<&'a Q> for Map<String, Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]
impl<'a, Q> IndexMut<&'a Q> for Map<String, Value> where
Q: Ord + Eq + Hash + ?Sized,
String: Borrow<Q>,
[src]Mutably access an element of this map. Panics if the given key is not present in the map.
map["key"] = json!("value");
impl<'a> IntoIterator for &'a Map<String, Value>
[src]
impl<'a> IntoIterator for &'a Map<String, Value>
[src]impl<'a> IntoIterator for &'a mut Map<String, Value>
[src]
impl<'a> IntoIterator for &'a mut Map<String, Value>
[src]impl IntoIterator for Map<String, Value>
[src]
impl IntoIterator for Map<String, Value>
[src]impl Serialize for Map<String, Value>
[src]
impl Serialize for Map<String, Value>
[src]pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]Serialize this value into the given Serde serializer. Read more
impl Eq for Map<String, Value>
[src]
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Map<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for Map<K, V> where
K: Sync,
V: Sync,
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,
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,