Struct serde_yaml::Mapping
source · pub struct Mapping { /* private fields */ }
Expand description
A YAML mapping in which the keys and values are both serde_yaml::Value
.
Implementations
sourceimpl 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 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
sourceimpl<'de> Deserialize<'de> for Mapping
impl<'de> Deserialize<'de> for Mapping
sourcefn 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>,
sourceimpl Extend<(Value, Value)> for Mapping
impl Extend<(Value, Value)> for Mapping
sourcefn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)sourceimpl FromIterator<(Value, Value)> for Mapping
impl FromIterator<(Value, Value)> for Mapping
sourceimpl<'a> IntoIterator for &'a Mapping
impl<'a> IntoIterator for &'a Mapping
sourceimpl<'a> IntoIterator for &'a mut Mapping
impl<'a> IntoIterator for &'a mut Mapping
sourceimpl IntoIterator for Mapping
impl IntoIterator for Mapping
sourceimpl PartialOrd<Mapping> for Mapping
impl PartialOrd<Mapping> for Mapping
sourcefn partial_cmp(&self, other: &Mapping) -> Option<Ordering>
fn partial_cmp(&self, other: &Mapping) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more