Crates.io | sneks |
lib.rs | sneks |
version | 0.1.3 |
source | src |
created_at | 2023-09-28 22:17:30.342698 |
updated_at | 2024-06-10 21:55:11.582001 |
description | simple macros for naming enum variants |
homepage | https://github.com/OffchainLabs/sneks |
repository | https://github.com/OffchainLabs/sneks |
max_upload_size | |
id | 986747 |
size | 18,733 |
This crate provides simple proc macros for naming enum variants.
#[derive(SimpleSnakeNames)]
enum Animal {
HoneyBee,
GreatWhiteShark(usize),
PoisonDartFrog { spotted: bool },
}
// expands to
impl Animal {
fn name(&self) -> &'static str {
match self {
HoneyBee => "honey_bee",
GreatWhiteShark(..) => "great_white_shark",
PoisonDartFrog { .. } => "poison_dart_frog",
}
}
}
© 2022-2023 Offchain Labs, Inc.
This project is licensed under either of
at your option.
The SPDX license identifier for this project is MIT OR Apache-2.0
.