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

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

#78 in #alias

Download history 83/week @ 2024-07-29 208/week @ 2024-08-05 482/week @ 2024-08-12 588/week @ 2024-08-19 366/week @ 2024-08-26 525/week @ 2024-09-02 418/week @ 2024-09-09 340/week @ 2024-09-16 377/week @ 2024-09-23 352/week @ 2024-09-30 381/week @ 2024-10-07 586/week @ 2024-10-14 666/week @ 2024-10-21 719/week @ 2024-10-28 765/week @ 2024-11-04 578/week @ 2024-11-11

2,752 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
~38K SLoC