Crates.io | enum_data_proc |
lib.rs | enum_data_proc |
version | 0.1.0 |
source | src |
created_at | 2023-06-17 10:50:21.167018 |
updated_at | 2023-06-17 10:50:21.167018 |
description | a proc-macro,Add bit operations and arithmetic operations to enum |
homepage | |
repository | https://github.com/aenu/enum_data_proc |
max_upload_size | |
id | 892830 |
size | 10,336 |
Add bit operations and arithmetic operations to enum
use enum_data_proc::*;
#[repr(u32)]
#[derive(BitOp,ArithOp)]
enum A{
a=7,b,c,d,e,f,
}
fn main() {
println!("{:?}",[
A::a+1,
A::b<<1,
1&A::c,
A::d|A::d,
A::e%2,
2*A::f]
);
}