Crates.io | enum_inject |
lib.rs | enum_inject |
version | 0.1.4 |
source | src |
created_at | 2024-10-27 05:45:50.500249 |
updated_at | 2024-10-27 13:44:05.566248 |
description | Implement inject For the Enumeration |
homepage | https://github.com/ptechen |
repository | https://github.com/ptechen/enum_inject.git |
max_upload_size | |
id | 1424357 |
size | 8,923 |
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);
}