-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bitfield): add
enum_from_bits!
macro (#450)
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: ```rust 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... Closes #443
- Loading branch information
Showing
4 changed files
with
494 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.