10 unstable releases (4 breaking)

0.5.0 Mar 20, 2020
0.4.0 Jan 7, 2020
0.3.0 Jan 1, 2020
0.2.5 Apr 24, 2019
0.1.2 Jan 30, 2019

#361 in Encoding

Download history 13573/week @ 2023-11-20 15284/week @ 2023-11-27 13314/week @ 2023-12-04 14206/week @ 2023-12-11 12234/week @ 2023-12-18 8173/week @ 2023-12-25 10349/week @ 2024-01-01 12447/week @ 2024-01-08 12453/week @ 2024-01-15 12532/week @ 2024-01-22 13727/week @ 2024-01-29 13181/week @ 2024-02-05 14075/week @ 2024-02-12 13685/week @ 2024-02-19 14688/week @ 2024-02-26 13176/week @ 2024-03-04

56,042 downloads per month
Used in 175 crates (34 directly)

MIT license

14KB
368 lines

serde_tuple

De/serialize structs with named fields as array of values.

See: https://github.com/dtolnay/request-for-implementation/issues/3

Usage

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


lib.rs:

Derive macros to serialize and deserialize struct with named fields as an array of values

Examples

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]

Dependencies

~1.2–1.6MB
~39K SLoC