[−][src]Struct zvariant::OwnedValue
Owned Value
Methods from Deref<Target = Value<'static>>
pub fn value_signature(&self) -> Signature<'_>
[src]
Get the signature of the enclosed value.
pub fn downcast_ref<T>(&'a self) -> Option<&'a T> where
T: ?Sized,
&'a T: TryFrom<&'a Value<'a>>,
[src]
T: ?Sized,
&'a T: TryFrom<&'a Value<'a>>,
Try to get a reference to the underlying type T
.
Same as downcast
except it doesn't consume self
and get a reference to the underlying
value.
Examples
use std::convert::TryFrom; use zvariant::{Result, Value}; fn value_vec_to_type_vec<'a, T>(values: &'a Vec<Value<'a>>) -> Result<Vec<&'a T>> where &'a T: TryFrom<&'a Value<'a>>, { let mut res = vec![]; for value in values.into_iter() { res.push(value.downcast_ref().unwrap()); } Ok(res) } // Let's try u32 values first let v = vec![Value::U32(42), Value::U32(43)]; let v = value_vec_to_type_vec::<u32>(&v).unwrap(); assert_eq!(*v[0], 42); assert_eq!(*v[1], 43); // Now try Value values let v = vec![Value::new(Value::U32(42)), Value::new(Value::U32(43))]; let v = value_vec_to_type_vec::<Value>(&v).unwrap(); assert_eq!(*v[0], Value::U32(42)); assert_eq!(*v[1], Value::U32(43));
Trait Implementations
impl Clone for OwnedValue
[src]
fn clone(&self) -> OwnedValue
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for OwnedValue
[src]
impl Deref for OwnedValue
[src]
type Target = Value<'static>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'de> Deserialize<'de> for OwnedValue
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<'a, '_> From<&'_ Value<'a>> for OwnedValue
[src]
impl<'a> From<Value<'a>> for OwnedValue
[src]
impl PartialEq<OwnedValue> for OwnedValue
[src]
fn eq(&self, other: &OwnedValue) -> bool
[src]
fn ne(&self, other: &OwnedValue) -> bool
[src]
impl Serialize for OwnedValue
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for OwnedValue
[src]
impl<'a> TryFrom<&'a OwnedValue> for u8
[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 OwnedValue> for bool
[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 OwnedValue> for &'a Signature<'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 OwnedValue> for &'a ObjectPath<'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 OwnedValue> for &'a Array<'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 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 OwnedValue> for &'a Structure<'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 OwnedValue> for Fd
[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 OwnedValue> for i16
[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 OwnedValue> for u16
[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 OwnedValue> for i32
[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 OwnedValue> for u32
[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 OwnedValue> for i64
[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 OwnedValue> for u64
[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 OwnedValue> for f64
[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 OwnedValue> for &'a str
[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<OwnedValue> for u8
[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<OwnedValue> for bool
[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<OwnedValue> for Signature<'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<OwnedValue> for ObjectPath<'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<OwnedValue> for Array<'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<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<OwnedValue> for Structure<'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<OwnedValue> for Fd
[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, T> TryFrom<OwnedValue> for Vec<T> where
T: TryFrom<Value<'a>, Error = Error> + 'a,
[src]
T: TryFrom<Value<'a>, Error = Error> + 'a,
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: OwnedValue) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<OwnedValue> for i16
[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<OwnedValue> for u16
[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<OwnedValue> for i32
[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<OwnedValue> for u32
[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<OwnedValue> for i64
[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<OwnedValue> for u64
[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<OwnedValue> for f64
[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<OwnedValue> for String
[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> Type for OwnedValue
[src]
Auto Trait Implementations
impl RefUnwindSafe for OwnedValue
impl Send for OwnedValue
impl Sync for OwnedValue
impl Unpin for OwnedValue
impl UnwindSafe for OwnedValue
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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>,