Struct zvariant::Dict [−][src]
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]
&mut self,
key: Value<'kv>,
value: Value<'vv>
) -> Result<(), Error>
Append key
and value
as a new entry.
Errors
- if
key.value_signature()
doesn’t match the key signatureself
was created for. - if
value.value_signature()
doesn’t match the value signatureself
was created for.
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]
K: Basic + Into<Value<'k>> + Hash + Eq,
V: Into<Value<'v>> + Type,
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]
'd: 'k + 'v,
K: Eq + 'k,
V: ?Sized,
&'k K: TryFrom<&'k Value<'k>>,
&'v V: TryFrom<&'v Value<'v>>,
Get the value for the given key.
pub fn signature(&self) -> Signature<'static>
[src]
Get the signature of this Dict
.
NB: This method potentially allocates and copies. Use full_signature
if you’d like to
avoid that.
pub fn full_signature(&self) -> &Signature<'_>
[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]
K: Type + Into<Value<'k>> + Hash + Eq,
V: Type + Into<Value<'v>>,
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.
fn try_from(v: &'a OwnedValue) -> Result<Self, Self::Error>
[src]
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.
fn try_from(value: &'a Value<'a>) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a Value<'a>> for Dict<'a, 'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<OwnedValue> for Dict<'a, 'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: OwnedValue) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<Value<'a>> for Dict<'a, 'a>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,