[][src]Struct zvariant::Dict

pub struct Dict<'k, 'v> { /* fields omitted */ }

A helper type to wrap dictionaries in a Value.

API is provided to convert from, and to a HashMap.

Implementations

impl<'k, 'v> Dict<'k, 'v>[src]

pub fn new(key_signature: Signature<'k>, value_signature: Signature<'v>) -> Self[src]

Create a new empty Dict, given the signature of the keys and values.

pub fn append<'kv: 'k, 'vv: 'v>(
    &mut self,
    key: Value<'kv>,
    value: Value<'vv>
) -> Result<(), Error>
[src]

Append key and value as a new entry.

Errors

pub fn add<K, V>(&mut self, key: K, value: V) -> Result<(), Error> where
    K: Basic + Into<Value<'k>> + Hash + Eq,
    V: Into<Value<'v>> + Type
[src]

Add a new entry.

pub fn get<'d, K: ?Sized, V>(&'d self, key: &K) -> Result<Option<&'v V>, Error> where
    'd: 'k + 'v,
    K: Eq + 'k,
    V: ?Sized,
    &'k K: TryFrom<&'k Value<'k>>,
    &'v V: TryFrom<&'v Value<'v>>, 
[src]

Get the value for the given key.

pub fn signature(&self) -> Signature<'static>[src]

Get the signature of this Dict.

Trait Implementations

impl<'k, 'v> Clone for Dict<'k, 'v>[src]

impl<'k, 'v> Debug for Dict<'k, 'v>[src]

impl<'a> From<&'a Dict<'a, 'a>> for Value<'a>[src]

impl<'a> From<Dict<'a, 'a>> for Value<'a>[src]

impl<'k, 'v, K, V> From<HashMap<K, V, RandomState>> for Dict<'k, 'v> where
    K: Type + Into<Value<'k>> + Hash + Eq,
    V: Type + Into<Value<'v>>, 
[src]

impl<'k, 'v> PartialEq<Dict<'k, 'v>> for Dict<'k, 'v>[src]

impl<'k, 'v> Serialize for Dict<'k, 'v>[src]

impl<'k, 'v> StructuralPartialEq for Dict<'k, 'v>[src]

impl<'a> TryFrom<&'a OwnedValue> for &'a Dict<'a, 'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value<'a>> for &'a Dict<'a, 'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value<'a>> for Dict<'a, 'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'k, 'v, K, V, H> TryFrom<Dict<'k, 'v>> for HashMap<K, V, H> where
    K: Basic + TryFrom<Value<'k>> + Hash + Eq,
    V: TryFrom<Value<'v>>,
    H: BuildHasher + Default
[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<OwnedValue> for Dict<'a, 'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Value<'a>> for Dict<'a, 'a>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'k, 'v> RefUnwindSafe for Dict<'k, 'v>

impl<'k, 'v> Send for Dict<'k, 'v>

impl<'k, 'v> Sync for Dict<'k, 'v>

impl<'k, 'v> Unpin for Dict<'k, 'v>

impl<'k, 'v> UnwindSafe for Dict<'k, 'v>

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.