[][src]Struct creator_plist::dictionary::Dictionary

pub struct Dictionary { /* fields omitted */ }

Represents a plist dictionary type.

Implementations

impl Dictionary[src]

pub fn new() -> Self[src]

Makes a new empty Dictionary.

pub fn clear(&mut self)[src]

Clears the dictionary, removing all values.

pub fn get(&self, key: &str) -> Option<&Value>[src]

Returns a reference to the value corresponding to the key.

pub fn contains_key(&self, key: &str) -> bool[src]

Returns true if the dictionary contains a value for the specified key.

pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>[src]

Returns a mutable reference to the value corresponding to the key.

pub fn insert(&mut self, k: String, v: Value) -> Option<Value>[src]

Inserts a key-value pair into the dictionary.

If the dictionary did not have this key present, None is returned.

If the dictionary did have this key present, the value is updated, and the old value is returned.

pub fn remove(&mut self, key: &str) -> Option<Value>[src]

Removes a key from the dictionary, returning the value at the key if the key was previously in the dictionary.

pub fn len(&self) -> usize[src]

Returns the number of elements in the dictionary.

pub fn is_empty(&self) -> bool[src]

Returns true if the dictionary contains no elements.

pub fn iter(&self) -> Iter<'_>

Notable traits for Iter<'a>

impl<'a> Iterator for Iter<'a> type Item = (&'a String, &'a Value);
[src]

Gets an iterator over the entries of the dictionary.

pub fn iter_mut(&mut self) -> IterMut<'_>

Notable traits for IterMut<'a>

impl<'a> Iterator for IterMut<'a> type Item = (&'a String, &'a mut Value);
[src]

Gets a mutable iterator over the entries of the dictionary.

pub fn keys(&self) -> Keys<'_>

Notable traits for Keys<'a>

impl<'a> Iterator for Keys<'a> type Item = &'a String;
[src]

Gets an iterator over the keys of the dictionary.

pub fn values(&self) -> Values<'_>

Notable traits for Values<'a>

impl<'a> Iterator for Values<'a> type Item = &'a Value;
[src]

Gets an iterator over the values of the dictionary.

pub fn values_mut(&mut self) -> ValuesMut<'_>

Notable traits for ValuesMut<'a>

impl<'a> Iterator for ValuesMut<'a> type Item = &'a mut Value;
[src]

Gets an iterator over mutable values of the dictionary.

Trait Implementations

impl Clone for Dictionary[src]

impl Debug for Dictionary[src]

impl Default for Dictionary[src]

impl Extend<(String, Value)> for Dictionary[src]

impl From<Dictionary> for Value[src]

impl FromIterator<(String, Value)> for Dictionary[src]

impl<'a> Index<&'a str> for Dictionary[src]

Access an element of this dictionary. Panics if the given key is not present in the dictionary.

match *val {
    Value::Array(ref arr) => arr[0].as_string(),
    Value::Dictionary(ref dict) => dict["type"].as_string(),
    Value::String(ref s) => Some(s.as_str()),
    _ => None,
}

type Output = Value

The returned type after indexing.

impl<'a> IndexMut<&'a str> for Dictionary[src]

Mutably access an element of this dictionary. Panics if the given key is not present in the dictionary.

dict["key"] = "value".into();

impl<'a> IntoIterator for &'a Dictionary[src]

type Item = (&'a String, &'a Value)

The type of the elements being iterated over.

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a mut Dictionary[src]

type Item = (&'a String, &'a mut Value)

The type of the elements being iterated over.

type IntoIter = IterMut<'a>

Which kind of iterator are we turning this into?

impl IntoIterator for Dictionary[src]

type Item = (String, Value)

The type of the elements being iterated over.

type IntoIter = IntoIter

Which kind of iterator are we turning this into?

impl PartialEq<Dictionary> for Dictionary[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.