Crates.io | serde_tuple_macros |
lib.rs | serde_tuple_macros |
version | 1.0.0 |
source | src |
created_at | 2020-03-20 18:50:57.387278 |
updated_at | 2024-09-14 19:12:11.737752 |
description | De/serialize structs with named fields as array of values |
homepage | |
repository | https://github.com/kardeiz/serde_tuple |
max_upload_size | |
id | 220765 |
size | 8,777 |
De/serialize structs with named fields as array of values.
See: https://github.com/dtolnay/request-for-implementation/issues/3
use serde_tuple::*;
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Foo<'a> {
bar: &'a str,
baz: i32
}
let foo = Foo { bar: "Yes", baz: 22 };
let json = serde_json::to_string(&foo).unwrap();
println!("{}", &json);
// # => ["Yes",22]
License: MIT