Enum zvariant::Value

source ·
pub enum Value<'a> {
Show 17 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>), Fd(Fd),
}
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 std::convert::TryFrom;
use zvariant::{from_slice, to_bytes, EncodingContext, Value};

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

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

// Decode it back
let v: Value = from_slice(&encoding, ctxt).unwrap();

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

Now let’s try a more complicated example:

use std::convert::TryFrom;
use zvariant::{from_slice, to_bytes, EncodingContext};
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 = EncodingContext::<byteorder::LE>::new_dbus(0);
let encoding = to_bytes(ctxt, &v).unwrap();
let v: Value = from_slice(&encoding, ctxt).unwrap();

// 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>)

§

Fd(Fd)

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 to_owned(&self) -> OwnedValue

Create an owned version of self.

Ideally, we should implement std::borrow::ToOwned trait for Value, but that’s implemented generically for us through impl<T: Clone> ToOwned for T and it’s not what we need/want.

source

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

Get the signature of the enclosed value.

source

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

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 std::convert::TryFrom;
use zvariant::{Result, Value};

fn value_vec_to_type_vec<'a, T>(values: Vec<Value<'a>>) -> Result<Vec<T>>
where
    T: TryFrom<Value<'a>>,
{
    let mut res = vec![];
    for value in values.into_iter() {
        res.push(value.downcast().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));
source

pub fn downcast_ref<T>(&'a self) -> Option<&'a T>
where 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§

source§

impl<'a> Clone for Value<'a>

source§

fn clone(&self) -> Value<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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 Array<'a>> for Value<'a>

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

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<'o> From<&'o OwnedValue> for Value<'o>

source§

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

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<'a> From<&Value<'a>> for OwnedValue

source§

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

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> for Value<'a>

source§

fn from(v: Fd) -> 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<ObjectPath<'a>> for Value<'a>

source§

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

Converts to this type from the input type.
source§

impl From<OwnedObjectPath> for Value<'static>

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<'static>

source§

fn from(v: OwnedValue) -> Value<'static>

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<'static>

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<'a> From<Value<'a>> for OwnedValue

source§

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

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<'a> PartialEq for Value<'a>

source§

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

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

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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 Value<'a>> for &'a Array<'a>

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

type Error = Error

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

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

Performs the conversion.
source§

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

source§

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<'a>> for Dict<'a, 'a>

source§

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<'a>> for Fd

source§

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<'a>> for ObjectPath<'a>

source§

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<'a>> for Signature<'a>

source§

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<'a>> for Str<'a>

source§

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<'a>> for String

source§

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<'a>> for Structure<'a>

source§

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<'a>> for bool

source§

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<'a>> for f64

source§

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<'a>> for i16

source§

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<'a>> for i32

source§

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<'a>> for i64

source§

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<'a>> for u16

source§

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<'a>> for u32

source§

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<'a>> for u64

source§

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<'a>> for u8

source§

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 OwnedObjectPath

source§

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

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>,

source§

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>

source§

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>,

source§

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>

source§

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

source§

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>,

source§

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>

source§

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 Signature<'a>

source§

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>

source§

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

source§

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>

source§

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>,

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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<'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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

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

source§

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>,

source§

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>,

source§

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>,