[−][src]Module serde_iter::map
Serializes an iterator of serializable 2-tuples into a serde map.
This module is motsly identical to serde_iter::seq
, except that iterators of tuples (K, V)
instead of single values are used.
Refer to the serde_iter::seq
documentation for details.
This module requires the "map" feature to be enabled (enabled by default).
Example
#[derive(serde::Serialize)] struct Foo { #[serde(with = "serde_iter::map")] bar: std::iter::Once<(&'static str, i32)>, } let foo = Foo { bar: std::iter::once(("qux", 3)), }; assert_eq!(serde_json::to_value(&foo).unwrap(), serde_json::json!({ "bar": { "qux": 3 } }));
Functions
serialize | Refer to the module-level documentation. |