Module ruma_serde::vec_as_map_of_empty[][src]

Expand description

Serde serialization and deserialization functions that map a Vec<T> to a BTreeMap<T, Empty>.

The Matrix spec sometimes specifies lists as hash maps so the list entries can be expanded with attributes without breaking compatibility. As that would be a breaking change for ruma’s event types anyway, we convert them to Vecs for simplicity, using this module.

To be used as #[serde(with = "vec_as_map_of_empty")].

Functions

deserialize

Deserialize an object and return the keys as a Vec<T>.

serialize

Serialize the given Vec<T> as a map of T => Empty.