Enum zvariant::Value

source ·
pub enum Value<'a> {
Show 18 variants U8(u8), Bool(bool), I16(i16), U16(u16), I32(i32), U32(u32), I64(i64), U64(u64), F64(f64), Str(Str<'a>), Signature(Signature<'a>), ObjectPath(ObjectPath<'a>), Value(Box<Value<'a>>), Array(Array<'a>), Dict(Dict<'a, 'a>), Structure(Structure<'a>), Maybe(Maybe<'a>), Fd(Fd<'a>),
}
Expand description

A generic container, in the form of an enum that holds exactly one value of any of the other types.

Note that this type corresponds to the VARIANT data type defined by the D-Bus specification and as such, its encoding is not the same as that of the enclosed value.

§Examples

use zvariant::{to_bytes, serialized::Context, Value, LE};

// Create a Value from an i16
let v = Value::new(i16::max_value());

// Encode it
let ctxt = Context::new_dbus(LE, 0);
let encoding = to_bytes(ctxt, &v).unwrap();

// Decode it back
let v: Value = encoding.deserialize().unwrap().0;

// Check everything is as expected
assert_eq!(i16::try_from(&v).unwrap(), i16::max_value());

Now let’s try a more complicated example:

use zvariant::{to_bytes, serialized::Context, LE};
use zvariant::{Structure, Value, Str};

// Create a Value from a tuple this time
let v = Value::new((i16::max_value(), "hello", true));

// Same drill as previous example
let ctxt = Context::new_dbus(LE, 0);
let encoding = to_bytes(ctxt, &v).unwrap();
let v: Value = encoding.deserialize().unwrap().0;

// Check everything is as expected
let s = Structure::try_from(v).unwrap();
assert_eq!(
    <(i16, Str, bool)>::try_from(s).unwrap(),
    (i16::max_value(), Str::from("hello"), true),
);

Variants§

§

U8(u8)

§

Bool(bool)

§

I16(i16)

§

U16(u16)

§

I32(i32)

§

U32(u32)

§

I64(i64)

§

U64(u64)

§

F64(f64)

§

Str(Str<'a>)

§

Signature(Signature<'a>)

§

ObjectPath(ObjectPath<'a>)

§

Value(Box<Value<'a>>)

§

Array(Array<'a>)

§

Dict(Dict<'a, 'a>)

§

Structure(Structure<'a>)

§

Maybe(Maybe<'a>)

§

Fd(Fd<'a>)

Implementations§

source§

impl<'a> Value<'a>

source

pub fn new<T>(value: T) -> Self
where T: Into<Self> + DynamicType,

Make a Value for a given value.

In general, you can use Into trait on basic types, except when you explicitly need to wrap Value itself, in which case this constructor comes handy.

§Examples
use zvariant::Value;

let s = Value::new("hello");
let u: Value = 51.into();
assert_ne!(s, u);
source

pub fn try_to_owned(&self) -> Result<OwnedValue>

Try to create an owned version of self.

§Errors

This method can currently only fail on Unix platforms for Value::Fd variant. This happens when the current process exceeds the maximum number of open file descriptors.

source

pub fn value_signature(&self) -> Signature<'_>

Get the signature of the enclosed value.

source

pub fn try_clone(&self) -> Result<Self>

Try to clone the value.

§Errors

This method can currently only fail on Unix platforms for Value::Fd variant containing an Fd::Owned variant. This happens when the current process exceeds the maximum number of open file descriptors.

source

pub fn downcast<T>(self) -> Result<T, Error>
where T: ?Sized + TryFrom<Value<'a>>, <T as TryFrom<Value<'a>>>::Error: Into<Error>,

Try to get the underlying type T.

Note that TryFrom<Value> is implemented for various types, and it’s usually best to use that instead. However, in generic code where you also want to unwrap Value::Value, you should use this function (because TryFrom<Value> can not be implemented for Value itself as From<Value> is implicitly implemented for Value).

§Examples
use zvariant::{Error, Result, Value};

fn value_vec_to_type_vec<'a, T>(values: Vec<Value<'a>>) -> Result<Vec<T>>
where
    T: TryFrom<Value<'a>>,
    <T as TryFrom<Value<'a>>>::Error: Into<Error>,
{
    let mut res = vec![];
    for value in values.into_iter() {
        res.push(value.downcast()?);
    }

    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));
source

pub fn downcast_ref<T>(&'a self) -> Result<T, Error>
where T: ?Sized + TryFrom<&'a Value<'a>>, <T as TryFrom<&'a Value<'a>>>::Error: Into<Error>,

Try to get the underlying type T.

Same as downcast except it doesn’t consume self and hence requires T: TryFrom<&Value<_>>.

§Examples
use zvariant::{Error, 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>>,
    <&'a T as TryFrom<&'a Value<'a>>>::Error: Into<Error>,
{
    let mut res = vec![];
    for value in values.into_iter() {
        res.push(value.downcast_ref()?);
    }

    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§

source§

impl<'a> Debug for Value<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de: 'a, 'a> Deserialize<'de> for Value<'a>

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Value<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a &'a str> for Value<'a>

source§

fn from(v: &'a &'a str) -> Self

Converts to this type from the input type.
source§

impl<'v, V> From<&'v [V]> for Value<'v>
where &'v [V]: Into<Array<'v>>,

source§

fn from(v: &'v [V]) -> Value<'v>

Converts to this type from the input type.
source§

impl<'a> From<&'a ObjectPath<'a>> for Value<'a>

source§

fn from(v: &'a ObjectPath<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Signature<'a>> for Value<'a>

source§

fn from(v: &'a Signature<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Str<'a>> for Value<'a>

source§

fn from(v: &'a Str<'a>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<&'v String> for Value<'v>

source§

fn from(v: &'v String) -> Value<'v>

Converts to this type from the input type.
source§

impl<'v, V> From<&'v Vec<V>> for Value<'v>
where &'v Vec<V>: Into<Array<'v>>,

source§

fn from(v: &'v Vec<V>) -> Value<'v>

Converts to this type from the input type.
source§

impl<'a> From<&'a bool> for Value<'a>

source§

fn from(v: &'a bool) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a f32> for Value<'a>

source§

fn from(v: &'a f32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a f64> for Value<'a>

source§

fn from(v: &'a f64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a i16> for Value<'a>

source§

fn from(v: &'a i16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a i32> for Value<'a>

source§

fn from(v: &'a i32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a i64> for Value<'a>

source§

fn from(v: &'a i64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a i8> for Value<'a>

source§

fn from(v: &'a i8) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for Value<'a>

source§

fn from(v: &'a str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a u16> for Value<'a>

source§

fn from(v: &'a u16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a u32> for Value<'a>

source§

fn from(v: &'a u32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a u64> for Value<'a>

source§

fn from(v: &'a u64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a u8> for Value<'a>

source§

fn from(v: &'a u8) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Array<'a>> for Value<'a>

source§

fn from(v: Array<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Dict<'a, 'a>> for Value<'a>

source§

fn from(v: Dict<'a, 'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Fd<'a>> for Value<'a>

source§

fn from(v: Fd<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'k, 'v, K, V, H> From<HashMap<K, V, H>> for Value<'a>
where K: Type + Into<Value<'k>> + Hash + Eq, V: Type + Into<Value<'v>>, H: BuildHasher + Default, 'k: 'a, 'v: 'a,

source§

fn from(value: HashMap<K, V, H>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Maybe<'a>> for Value<'a>

source§

fn from(v: Maybe<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<ObjectPath<'a>> for Value<'a>

source§

fn from(v: ObjectPath<'a>) -> Self

Converts to this type from the input type.
source§

impl<'v, V> From<Option<V>> for Value<'v>
where V: Into<Value<'v>> + Type,

source§

fn from(v: Option<V>) -> Value<'v>

Converts to this type from the input type.
source§

impl<'v, V> From<Optional<V>> for Value<'v>
where V: Into<Value<'v>> + NoneValue<NoneType = V>,

source§

fn from(v: Optional<V>) -> Value<'v>

Converts to this type from the input type.
source§

impl From<OwnedObjectPath> for Value<'_>

source§

fn from(o: OwnedObjectPath) -> Self

Converts to this type from the input type.
source§

impl From<OwnedSignature> for Value<'static>

source§

fn from(o: OwnedSignature) -> Self

Converts to this type from the input type.
source§

impl From<OwnedValue> for Value<'_>

source§

fn from(v: OwnedValue) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Signature<'a>> for Value<'a>

source§

fn from(v: Signature<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Str<'a>> for Value<'a>

source§

fn from(v: Str<'a>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value<'_>

source§

fn from(v: String) -> Self

Converts to this type from the input type.
source§

impl<'v, 's: 'v, T> From<T> for Value<'v>
where T: Into<Structure<'s>>,

source§

fn from(v: T) -> Value<'v>

Converts to this type from the input type.
source§

impl<'v, V> From<Vec<V>> for Value<'v>
where Vec<V>: Into<Array<'v>>,

source§

fn from(v: Vec<V>) -> Value<'v>

Converts to this type from the input type.
source§

impl<'a> From<bool> for Value<'a>

source§

fn from(v: bool) -> Self

Converts to this type from the input type.
source§

impl<'a> From<f32> for Value<'a>

source§

fn from(v: f32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<f64> for Value<'a>

source§

fn from(v: f64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i16> for Value<'a>

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i32> for Value<'a>

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i64> for Value<'a>

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i8> for Value<'a>

source§

fn from(v: i8) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u16> for Value<'a>

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u32> for Value<'a>

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u64> for Value<'a>

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u8> for Value<'a>

source§

fn from(v: u8) -> Self

Converts to this type from the input type.
source§

impl Hash for Value<'_>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Value<'_>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<'a> PartialEq for Value<'a>

source§

fn eq(&self, other: &Value<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd for Value<'a>

source§

fn partial_cmp(&self, other: &Value<'a>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Serialize for Value<'a>

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> TryFrom<&'a Array<'a>> for Value<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &'a Array<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Dict<'a, 'a>> for Value<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &'a Dict<'a, 'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Fd<'a>> for Value<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &'a Fd<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Maybe<'a>> for Value<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &'a Maybe<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'o> TryFrom<&'o OwnedValue> for Value<'o>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &'o OwnedValue) -> Result<Value<'o>>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Array<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Dict<'a, 'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Fd<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Maybe<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a ObjectPath<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Signature<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Str<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a Structure<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a bool

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a f64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a i16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a i32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a i64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a str

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a u16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a u32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a u64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a Value<'_>> for &'a u8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value<'_>> for String

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Array<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Dict<'a, 'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Fd<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Maybe<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for ObjectPath<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for OwnedValue

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: &Value<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Signature<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Str<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Structure<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for Value<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Value<'a>>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for bool

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for f64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for i16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for i32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for i64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for u16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for u32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for u64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&Value<'a>> for u8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value<'_>> for OwnedObjectPath

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value<'_>> for OwnedSignature

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0> TryFrom<Value<'a>> for (T0,)
where T0: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1> TryFrom<Value<'a>> for (T0, T1)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2> TryFrom<Value<'a>> for (T0, T1, T2)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3> TryFrom<Value<'a>> for (T0, T1, T2, T3)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, T11: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, T11: TryFrom<Value<'a>, Error = E>, T12: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, T11: TryFrom<Value<'a>, Error = E>, T12: TryFrom<Value<'a>, Error = E>, T13: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, T11: TryFrom<Value<'a>, Error = E>, T12: TryFrom<Value<'a>, Error = E>, T13: TryFrom<Value<'a>, Error = E>, T14: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, E, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> TryFrom<Value<'a>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T0: TryFrom<Value<'a>, Error = E>, T1: TryFrom<Value<'a>, Error = E>, T2: TryFrom<Value<'a>, Error = E>, T3: TryFrom<Value<'a>, Error = E>, T4: TryFrom<Value<'a>, Error = E>, T5: TryFrom<Value<'a>, Error = E>, T6: TryFrom<Value<'a>, Error = E>, T7: TryFrom<Value<'a>, Error = E>, T8: TryFrom<Value<'a>, Error = E>, T9: TryFrom<Value<'a>, Error = E>, T10: TryFrom<Value<'a>, Error = E>, T11: TryFrom<Value<'a>, Error = E>, T12: TryFrom<Value<'a>, Error = E>, T13: TryFrom<Value<'a>, Error = E>, T14: TryFrom<Value<'a>, Error = E>, T15: TryFrom<Value<'a>, Error = E>, Error: From<E>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Array<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, F> TryFrom<Value<'a>> for BitFlags<F>
where F: BitFlag, F::Numeric: TryFrom<Value<'a>, Error = Error>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Dict<'a, 'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Fd<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, K, V, H> TryFrom<Value<'a>> for HashMap<K, V, H>
where K: Basic + TryFrom<Value<'a>> + Hash + Eq, V: TryFrom<Value<'a>>, H: BuildHasher + Default, K::Error: Into<Error>, V::Error: Into<Error>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Maybe<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for ObjectPath<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, T> TryFrom<Value<'a>> for Optional<T>
where T: TryFrom<Value<'a>> + NoneValue + PartialEq<<T as NoneValue>::NoneType>, T::Error: Into<Error>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for OwnedValue

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Value<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Signature<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Str<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for String

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for Structure<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a, T> TryFrom<Value<'a>> for Vec<T>
where T: TryFrom<Value<'a>>, T::Error: Into<Error>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for bool

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for f64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for i16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for i32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for i64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for u16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for u32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for u64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Value<'a>> for u8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Value<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> Type for Value<'a>

source§

fn signature() -> Signature<'static>

Get the signature for the implementing type. Read more
source§

impl Eq for Value<'_>

source§

impl<'a> StructuralPartialEq for Value<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Value<'a>

§

impl<'a> RefUnwindSafe for Value<'a>

§

impl<'a> Send for Value<'a>

§

impl<'a> Sync for Value<'a>

§

impl<'a> Unpin for Value<'a>

§

impl<'a> UnwindSafe for Value<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<'de, T> DynamicDeserialize<'de> for T
where T: Type + Deserialize<'de> + ?Sized,

§

type Deserializer = PhantomData<T>

A DeserializeSeed implementation for this type.
source§

fn deserializer_for_signature<S>( signature: S, ) -> Result<<T as DynamicDeserialize<'de>>::Deserializer, Error>
where S: TryInto<Signature<'de>>, <S as TryInto<Signature<'de>>>::Error: Into<Error>,

Get a deserializer compatible with this signature.
source§

impl<T> DynamicType for T
where T: Type + ?Sized,

source§

fn dynamic_signature(&self) -> Signature<'_>

Get the signature for the implementing type. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,