Crate tuple_vec_map [−] [src]
Deserializing maps to tuple-vecs.
Don't waste space and time making a HashMap when you will never use it!
To use, just include a Vec<(String, ...)>
in your struct instead of a HashMap<String, ...>
and tag it with #[serde(with = "tuple_vec_map")
!
extern crate tuple_vec_map; #[derive(Serialize, Deserialize)] struct SomeData { other_stuff: u32, #[serde(with = "tuple_vec_map")] inner_data: Vec<(String, String)>, }
That's it! Now your structure accepts an inner_data Map or JSON Object, and instead of making a whole HashMap for the data, the key/value pairs are simply collected into a Vec.
Functions
deserialize |
Deserialize to a Vec<(K, V)> as if it were a HashMap |
serialize |
Serialize a Vec<(K, V)> as if it were a HashMap |