5 releases
0.1.4 | Oct 27, 2024 |
---|---|
0.1.3 | Oct 27, 2024 |
0.1.2 | Oct 27, 2024 |
0.1.1 | Oct 27, 2024 |
0.1.0 | Oct 27, 2024 |
#297 in Procedural macros
374 downloads per month
7KB
111 lines
enum_inject
example:
use enum_inject::{enum_injector, EnumInjector};
use display_enum::Display;
#[derive(EnumInjector)]
#[enum_injector({"args":[{"prefix":"A","suffix":"B","compute":{"Mul":1000}},{"prefix":"AA","suffix":"BB","compute":{"Mul":3000}}],"derives":["#[repr(i32)]","#[derive(Display)]"]})]
enum Foo {
#[skip]
Test,
#[sync_attr]
B,
C
}
#[test]
fn test() {
assert_eq!("ABB", Foo::ABB.to_string());
assert_eq!(3000, Foo::AABBB as i32);
}
Dependencies
~0.7–1.6MB
~34K SLoC