Struct serde_yaml::mapping::Mapping
source · pub struct Mapping { /* private fields */ }
Expand description
A YAML mapping in which the keys and values are both serde_yaml::Value
.
Implementations§
source§impl Mapping
impl Mapping
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty YAML map with the given initial capacity.
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be inserted
into the map. The map may reserve more space to avoid frequent
allocations.
Panics
Panics if the new allocation size overflows usize
.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the map as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
sourcepub fn insert(&mut self, k: Value, v: Value) -> Option<Value>
pub fn insert(&mut self, k: Value, v: Value) -> Option<Value>
Inserts a key-value pair into the map. If the key already existed, the old value is returned.
sourcepub fn contains_key(&self, k: &Value) -> bool
pub fn contains_key(&self, k: &Value) -> bool
Checks if the map contains the given key.
sourcepub fn get(&self, k: &Value) -> Option<&Value>
pub fn get(&self, k: &Value) -> Option<&Value>
Returns the value corresponding to the key in the map.
sourcepub fn get_mut(&mut self, k: &Value) -> Option<&mut Value>
pub fn get_mut(&mut self, k: &Value) -> Option<&mut Value>
Returns the mutable reference corresponding to the key in the map.
sourcepub fn entry(&mut self, k: Value) -> Entry<'_>
pub fn entry(&mut self, k: Value) -> Entry<'_>
Gets the given key’s corresponding entry in the map for insertion and/or in-place manipulation.
sourcepub fn remove(&mut self, k: &Value) -> Option<Value>
pub fn remove(&mut self, k: &Value) -> Option<Value>
Removes and returns the value corresponding to the key from the map.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the maximum number of key-value pairs the map can hold without reallocating.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Mapping
impl<'de> Deserialize<'de> for Mapping
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 Extend<(Value, Value)> for Mapping
impl Extend<(Value, Value)> for Mapping
source§fn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)
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<'a> IntoIterator for &'a Mapping
impl<'a> IntoIterator for &'a Mapping
source§impl<'a> IntoIterator for &'a mut Mapping
impl<'a> IntoIterator for &'a mut Mapping
source§impl IntoIterator for Mapping
impl IntoIterator for Mapping
source§impl PartialEq<Mapping> for Mapping
impl PartialEq<Mapping> for Mapping
source§impl PartialOrd<Mapping> for Mapping
impl PartialOrd<Mapping> for Mapping
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Mapping
impl StructuralEq for Mapping
impl StructuralPartialEq for Mapping
Auto Trait Implementations§
impl RefUnwindSafe for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnwindSafe for Mapping
Blanket Implementations§
source§impl<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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.