Trait gvariant::SerializeTo
source · [−]pub trait SerializeTo<T: Cast + ?Sized> {
fn serialize(self, f: &mut impl Write) -> Result<usize>;
}
Expand description
Trait to enable Serialization to GVariant
T in this instance is the type to be serialised to. For example: for
GVariant type “ai” this will be [i32]
. This means that there is a
different SerializeTo trait for every GVariant type, and any rust type may
implement serialization to any GVariant type. For example &[u8]
can be
serialized as a GVariant string “s” with SerializeTo<Str>
or as a byte
array with SerializeTo<[u8]>
.
SerializeTo<>
is implemented for appropriate built-in types, and you may
wish to implement it for your own types as well.