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
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 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
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>,
Deserialize this value from the given Serde deserializer. Read more
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)
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> 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: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more