[−][src]Struct serde_yaml::Mapping
A YAML mapping in which the keys and values are both serde_yaml::Value.
Methods
impl Mapping[src]
impl Mappingpub fn new() -> Self[src]
pub fn new() -> SelfCreates an empty YAML map.
pub fn with_capacity(capacity: usize) -> Self[src]
pub fn with_capacity(capacity: usize) -> SelfCreates an empty YAML map with the given initial capacity.
pub fn reserve(&mut self, additional: usize)[src]
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.
pub fn shrink_to_fit(&mut self)[src]
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.
pub fn insert(&mut self, k: Value, v: Value) -> Option<Value>[src]
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.
pub fn contains_key(&self, k: &Value) -> bool[src]
pub fn contains_key(&self, k: &Value) -> boolChecks if the map contains the given key.
pub fn get(&self, k: &Value) -> Option<&Value>[src]
pub fn get(&self, k: &Value) -> Option<&Value>Returns the value corresponding to the key in the map.
pub fn get_mut(&mut self, k: &Value) -> Option<&mut Value>[src]
pub fn get_mut(&mut self, k: &Value) -> Option<&mut Value>Returns the mutable reference corresponding to the key in the map.
pub fn remove(&mut self, k: &Value) -> Option<Value>[src]
pub fn remove(&mut self, k: &Value) -> Option<Value>Removes and returns the value corresponding to the key from the map.
pub fn capacity(&self) -> usize[src]
pub fn capacity(&self) -> usizeReturns the maximum number of key-value pairs the map can hold without reallocating.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeReturns the number of key-value pairs in the map.
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolReturns whether the map is currently empty.
pub fn clear(&mut self)[src]
pub fn clear(&mut self)Clears the map of all key-value pairs.
pub fn iter(&self) -> Iter[src]
pub fn iter(&self) -> IterReturns a double-ended iterator visiting all key-value pairs in order of
insertion. Iterator element type is (&'a Value, &'a Value).
pub fn iter_mut(&mut self) -> IterMut[src]
pub fn iter_mut(&mut self) -> IterMutReturns a double-ended iterator visiting all key-value pairs in order of
insertion. Iterator element type is (&'a Value, &'a mut ValuE).
Trait Implementations
impl PartialOrd<Mapping> for Mapping[src]
impl PartialOrd<Mapping> for Mappingfn partial_cmp(&self, other: &Mapping) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Mapping) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Mapping) -> bool[src]
fn lt(&self, other: &Mapping) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Mapping) -> bool[src]
fn le(&self, other: &Mapping) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Mapping) -> bool[src]
fn gt(&self, other: &Mapping) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Mapping) -> bool[src]
fn ge(&self, other: &Mapping) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl PartialEq<Mapping> for Mapping[src]
impl PartialEq<Mapping> for Mappingfn eq(&self, other: &Mapping) -> bool[src]
fn eq(&self, other: &Mapping) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Mapping) -> bool[src]
fn ne(&self, other: &Mapping) -> boolThis method tests for !=.
impl Default for Mapping[src]
impl Default for Mappingimpl Clone for Mapping[src]
impl Clone for Mappingfn clone(&self) -> Mapping[src]
fn clone(&self) -> MappingReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<'a> IntoIterator for &'a Mapping[src]
impl<'a> IntoIterator for &'a Mappingtype Item = (&'a Value, &'a Value)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
fn into_iter(self) -> Self::IntoIterCreates an iterator from a value. Read more
impl<'a> IntoIterator for &'a mut Mapping[src]
impl<'a> IntoIterator for &'a mut Mappingtype Item = (&'a Value, &'a mut Value)
The type of the elements being iterated over.
type IntoIter = IterMut<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
fn into_iter(self) -> Self::IntoIterCreates an iterator from a value. Read more
impl IntoIterator for Mapping[src]
impl IntoIterator for Mappingtype Item = (Value, Value)
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
fn into_iter(self) -> Self::IntoIterCreates an iterator from a value. Read more
impl Extend<(Value, Value)> for Mapping[src]
impl Extend<(Value, Value)> for Mappingfn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)[src]
fn extend<I: IntoIterator<Item = (Value, Value)>>(&mut self, iter: I)Extends a collection with the contents of an iterator. Read more
impl From<Mapping> for Value[src]
impl From<Mapping> for Valuefn from(f: Mapping) -> Self[src]
fn from(f: Mapping) -> SelfConvert map (with string keys) to Value
Examples
use serde_yaml::{Mapping, Value}; let mut m = Mapping::new(); m.insert("Lorem".into(), "ipsum".into()); let x: Value = m.into();
impl Eq for Mapping[src]
impl Eq for Mappingimpl Debug for Mapping[src]
impl Debug for Mappingfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<'a> Index<&'a Value> for Mapping[src]
impl<'a> Index<&'a Value> for Mappingtype Output = Value
The returned type after indexing.
fn index(&self, index: &'a Value) -> &Value[src]
fn index(&self, index: &'a Value) -> &ValuePerforms the indexing (container[index]) operation.
impl<'a> IndexMut<&'a Value> for Mapping[src]
impl<'a> IndexMut<&'a Value> for Mappingfn index_mut(&mut self, index: &'a Value) -> &mut Value[src]
fn index_mut(&mut self, index: &'a Value) -> &mut ValuePerforms the mutable indexing (container[index]) operation.
impl Hash for Mapping[src]
impl Hash for Mappingfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl FromIterator<(Value, Value)> for Mapping[src]
impl FromIterator<(Value, Value)> for Mappingfn from_iter<I: IntoIterator<Item = (Value, Value)>>(iter: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = (Value, Value)>>(iter: I) -> SelfCreates a value from an iterator. Read more
impl Serialize for Mapping[src]
impl Serialize for Mappingfn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>[src]
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Mapping[src]
impl<'de> Deserialize<'de> for Mappingfn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, type Owned = T
fn to_owned(&self) -> T[src]
fn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)[src]
fn clone_into(&self, target: &mut T)🔬 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<I> IntoIterator for I where
I: Iterator, [src]
impl<I> IntoIterator for I where
I: Iterator, type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I[src]
fn into_iter(self) -> ICreates an iterator from a value. Read more
impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> From for T[src]
impl<T> From for Timpl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,