1 unstable release
0.1.0 | Oct 11, 2023 |
---|
#1533 in Procedural macros
3KB
enum_all_variants
Proc macro for generating impl Display for enums using serde_json
Example
use enum_to_string::ToJsonString;
use serde::Serialize;
#[derive(Debug, Serialize, ToJsonString)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
enum Direction {
Left,
Top,
Right,
Bottom,
}
fn main() {
println!("{}", Direction::Left.to_string());
}
Outputs:
LEFT
Dependencies
~0.6–1.4MB
~32K SLoC