bincode fails to serialize structs implementing zvariant::SerializeDict
The bincode can serialize structs implementing serde::Serialize
but not zvariant::Serialize
.
See this example:
use serde::Serialize;
use zbus::zvariant::SerializeDict;
#[derive(Serialize)]
struct S1 {
f1: u32,
}
#[derive(SerializeDict)]
struct S2 {
f1: u32,
}
fn main() {
let s1 = S1 { f1: 3 };
let s2 = S2 { f1: 3 };
bincode::serialize(&s1).unwrap(); // <- Works fine
bincode::serialize(&s2).unwrap(); // <- Error
}
This fails with: thread 'main' panicked at 'called Result::unwrap() on an Err value: SequenceMustHaveLength', src/main.rs:17:29