Closed zeenix closed 1 year ago
In GitLab by @oknozor on Apr 20, 2022, 13:51
Hello I have some trouble with dict and serialization I am not sure but this might be a bug. Here is a simple reproducer :
#[derive(SerializeDict, Type, Debug)] #[zvariant(signature = "a{sv}")] struct Dummy { one: String, two: String, three: i16, } #[test] fn serialize() { let _struct = Dummy { one: "one".to_string(), two: "two".to_string(), three: 14, }; let context = EncodingContext::<LE>::new_dbus(0); let bytes = to_bytes(context.clone(), &_struct).unwrap(); // Panics here ! let value: Value = from_slice(&bytes, context).unwrap(); }
This produces the following error :
Message("invalid value: character `\0`, expected D-Bus string type must not contain interior null bytes")
Is this expected ?
As said on the Matrix channel, Value has a specific encoding (VARIANT type of D-Bus) so you can't decode a non-VARIANT as Value directly.
Value
VARIANT
In GitLab by @oknozor on Apr 20, 2022, 13:51
Hello I have some trouble with dict and serialization I am not sure but this might be a bug. Here is a simple reproducer :
This produces the following error :
Is this expected ?