Module serde_seq

Module serde_seq 

Source
Available on crate feature serde only.
Expand description

Functions to serialize and deserialize a RingMap as an ordered sequence.

The default serde implementation serializes RingMap as a normal map, but there is no guarantee that serialization formats will preserve the order of the key-value pairs. This module serializes RingMap as a sequence of (key, value) elements instead, in order.

This module may be used in a field attribute for derived implementations:

#[derive(Deserialize, Serialize)]
struct Data {
    #[serde(with = "ringmap::map::serde_seq")]
    map: RingMap<i32, u64>,
    // ...
}

Functionsยง

deserialize
Deserializes a RingMap from an ordered sequence.
serialize
Serializes a RingMap as an ordered sequence.