enum_data_proc

Crates.ioenum_data_proc
lib.rsenum_data_proc
version0.1.0
sourcesrc
created_at2023-06-17 10:50:21.167018
updated_at2023-06-17 10:50:21.167018
descriptiona proc-macro,Add bit operations and arithmetic operations to enum
homepage
repositoryhttps://github.com/aenu/enum_data_proc
max_upload_size
id892830
size10,336
(aenu)

documentation

README

enum_data_proc

Add bit operations and arithmetic operations to enum

example

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]
    );
}

Commit count: 2

cargo fmt