pub struct Mapping { /* private fields */ }Expand description
An insertion-ordered YAML mapping whose keys and values are both Value.
Implementations§
Source§impl Mapping
impl Mapping
Sourcepub fn with_capacity(capacity: usize) -> Mapping
pub fn with_capacity(capacity: usize) -> Mapping
Creates an empty mapping with space for at least capacity entries.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more entries.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the mapping’s allocation as much as possible.
Sourcepub fn insert(&mut self, key: Value, value: Value) -> Option<Value>
pub fn insert(&mut self, key: Value, value: Value) -> Option<Value>
Inserts an entry, returning the previous value when the key existed.
Sourcepub fn contains_key<I>(&self, index: I) -> boolwhere
I: Index,
pub fn contains_key<I>(&self, index: I) -> boolwhere
I: Index,
Returns whether the mapping contains index.
Sourcepub fn get<I>(&self, index: I) -> Option<&Value>where
I: Index,
pub fn get<I>(&self, index: I) -> Option<&Value>where
I: Index,
Returns the value selected by index.
Sourcepub fn get_mut<I>(&mut self, index: I) -> Option<&mut Value>where
I: Index,
pub fn get_mut<I>(&mut self, index: I) -> Option<&mut Value>where
I: Index,
Returns a mutable value selected by index.
Sourcepub fn remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
pub fn remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
Removes an entry by swapping the last entry into its position.
Sourcepub fn remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
pub fn remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
Removes and returns an entry by swapping the last entry into its position.
Sourcepub fn swap_remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
pub fn swap_remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
Removes a value by swapping the last entry into its position.
Sourcepub fn swap_remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
pub fn swap_remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
Removes an entry by swapping the last entry into its position.
Sourcepub fn shift_remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
pub fn shift_remove<I>(&mut self, index: I) -> Option<Value>where
I: Index,
Removes a value while retaining the relative order of other entries.
Sourcepub fn shift_remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
pub fn shift_remove_entry<I>(&mut self, index: I) -> Option<(Value, Value)>where
I: Index,
Removes an entry while retaining the relative order of other entries.
Sourcepub fn values_mut(&mut self) -> ValuesMut<'_> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_> ⓘ
Mutably iterates over values in insertion order.
Sourcepub fn into_values(self) -> IntoValues ⓘ
pub fn into_values(self) -> IntoValues ⓘ
Consumes the mapping and iterates over its values.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mapping
impl<'de> Deserialize<'de> for Mapping
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Mapping, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Mapping, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for Mapping
Source§impl Extend<(Value, Value)> for Mapping
impl Extend<(Value, Value)> for Mapping
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
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)