Module indexmap::map::serde_seq

source ·
Expand description

Functions to serialize and deserialize an IndexMap as an ordered sequence.

The default serde implementation serializes IndexMap as a normal map, but there is no guarantee that serialization formats will preserve the order of the key-value pairs. This module serializes IndexMap 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 = "indexmap::map::serde_seq")]
    map: IndexMap<i32, u64>,
    // ...


  • SeqVisitor 🔒
    Visitor to deserialize a sequenced IndexMap