Serialization of HashMap containing `Value` as values broken for GVariant format
This code
#[derive(Deserialize, Serialize, Type, PartialEq, Debug)]
struct ZVStruct<'s>(#[serde(borrow)] HashMap<&'s str, Value<'s>>);
let mut dict = HashMap::new();
dict.insert("hi", Value::from("hello"));
dict.insert("bye", Value::from("then"));
let element = ZVStruct(dict);
let ctxt = Context::<LE>::new_gvariant(0);
let signature = ZVStruct::signature();
let encoded = to_bytes_for_signature(ctxt, &signature, &element).unwrap();
fails with panicked at 'called
Result::unwrap()on an
Errvalue: Message("invalid type: character
s, expected
s,
g,
oor
v")'
from the serializer. The issue is specific to Dict
in a Value
. Interestingly we don't get any error if there is only 1 entry in the dict.