Closed hawkw closed 1 year ago
This branch adds a macro to the mycelium-bitfield crate that allows automatically generating FromBits implementations for enum types that are repr(u{N}). For example, we can now write:
mycelium-bitfield
FromBits
enum
repr(u{N})
mycelium_bitfield::enum_from_bits! { #[derive(Debug, Eq, PartialEq)] pub enum MyGeneratedEnum<u8> { /// Isn't this cool? Wow = 0b1001, /// It sure is! :D Whoa = 0b0110, } }
This probably should be a derive proc-macro but I'm having so much fun doing macro_rules! crimes in the bitfield crate for whatever reason...
derive
macro_rules!
Closes https://github.com/hawkw/mycelium/issues/443
This branch adds a macro to the
mycelium-bitfield
crate that allows automatically generatingFromBits
implementations forenum
types that arerepr(u{N})
. For example, we can now write:This probably should be a
derive
proc-macro but I'm having so much fun doingmacro_rules!
crimes in the bitfield crate for whatever reason...Closes https://github.com/hawkw/mycelium/issues/443