Trait zvariant::Type [−][src]
Expand description
Trait implemented by all serializable types.
This very simple trait provides the signature for the implementing type. Since the D-Bus type
system relies on these signatures, our serialization and deserialization API requires this
trait in addition to Serialize
and Deserialize
, respectively.
Implementation is provided for all the basic types and blanket implementations for common
container types, such as, arrays, slices, tuples, Vec
and HashMap
. For easy
implementation for custom types, use Type
derive macro from zvariant_derive crate.
Please note, that API is also provided to serialize and deserialize types that do not implement this trait but then you have to provide the correct signature yourself.
Required methods
Get the signature for the implementing type.
Example
use std::collections::HashMap; use zvariant::Type; assert_eq!(u32::signature(), "u"); assert_eq!(String::signature(), "s"); assert_eq!(<(u32, &str, u64)>::signature(), "(ust)"); assert_eq!(<(u32, &str, &[u64])>::signature(), "(usat)"); assert_eq!(<HashMap<u8, &str>>::signature(), "a{ys}");
Implementations on Foreign Types
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Type for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) where
T0: Type,
T1: Type,
T2: Type,
T3: Type,
T4: Type,
T5: Type,
T6: Type,
T7: Type,
T8: Type,
T9: Type,
T10: Type,
T11: Type,
T12: Type,
T13: Type,
T14: Type,
[src]
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Type for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) where
T0: Type,
T1: Type,
T2: Type,
T3: Type,
T4: Type,
T5: Type,
T6: Type,
T7: Type,
T8: Type,
T9: Type,
T10: Type,
T11: Type,
T12: Type,
T13: Type,
T14: Type,
[src]impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Type for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) where
T0: Type,
T1: Type,
T2: Type,
T3: Type,
T4: Type,
T5: Type,
T6: Type,
T7: Type,
T8: Type,
T9: Type,
T10: Type,
T11: Type,
T12: Type,
T13: Type,
T14: Type,
T15: Type,
[src]
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Type for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) where
T0: Type,
T1: Type,
T2: Type,
T3: Type,
T4: Type,
T5: Type,
T6: Type,
T7: Type,
T8: Type,
T9: Type,
T10: Type,
T11: Type,
T12: Type,
T13: Type,
T14: Type,
T15: Type,
[src]