https://github.com/xigh/reg-enum-macro-rs
https://github.com/xigh/reg-enum-macro-rs
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xigh/reg-enum-macro-rs
- Owner: xigh
- License: mit
- Created: 2022-04-18T17:59:44.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-18T18:06:26.000Z (about 3 years ago)
- Last Synced: 2025-01-08T06:20:07.747Z (5 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reg-enum-macro-rs : simple rust helper macro for enum definitions
```rust
use reg_enum_macro_rs::reg_enum;reg_enum!(T, u16, {
cycle = 0,
time = 1,
next = [2, 2, 31],
});fn main() {
let x = T::cycle;
println!("{:?} = {}", x, x.to_u16());
let y = T::from_u16(34);
println!("{:?}", y);
println!("{:?} = {}", T::next8, T::next8.to_u16());
}
```