Skip to content

Rename all enum fields to dot.case

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

nitn3lav/serde-dot-case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serde-dot-case

Rename all enum fields to dot.case.

use serde::{Deserialize, Serialize};
use serde_dot_case::serde_dot_case;

#[serde_dot_case]
#[derive(Debug, Deserialize, Serialize)]
enum MyEnum {
    MyVariant,
}

#[test]
fn deserialize() {
    assert!(matches!(
        serde_json::from_str::<MyEnum>("\"my.variant\"").unwrap(),
        MyEnum::MyVariant
    ));
}

#[test]
fn serialize() {
    assert_eq!(
        "\"my.variant\"",
        serde_json::to_string(&MyEnum::MyVariant).unwrap(),
    );
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in serde-dot-case by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Rename all enum fields to dot.case

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages