#alias #serde #proc-macro #struct-fields

macro serde_alias

An attribute macro to apply serde aliases to all struct fields

2 releases

0.0.2 Dec 4, 2020
0.0.1 Dec 4, 2020

#75 in #alias

Download history 31/week @ 2024-03-14 45/week @ 2024-03-21 104/week @ 2024-03-28 52/week @ 2024-04-04 89/week @ 2024-04-11 46/week @ 2024-04-18 76/week @ 2024-04-25 57/week @ 2024-05-02 51/week @ 2024-05-09 111/week @ 2024-05-16 100/week @ 2024-05-23 59/week @ 2024-05-30 106/week @ 2024-06-06 116/week @ 2024-06-13 60/week @ 2024-06-20 32/week @ 2024-06-27

325 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

8KB
135 lines

serde_alias

An attribute macro to add deserializing serde casing aliases for all fields in a struct

Simply list which aliase casing types should be applied

extern crate serde_alias;

use serde::{Deserialize};
use serde_alias::serde_alias;

#[serde_alias(
    CamelCase,
    PascalCase,
    LowerCase,
    UpperCase,
    SnakeCase,
    ScreamingSnakeCase,
    KebabCase,
    ScreamingKebabCase
)]
#[derive(Deserialize)]
struct Foo {
    bar: String,
}

Dependencies

~1.5MB
~37K SLoC