num_enum
num_enum copied to clipboard
reference: https://github.com/tkaitchuck/aHash/issues/200 need to update ahash version
Fixed #144
I have tried this code: ```rust #[derive(FromPrimitive)] #[repr(u8)] enum Number { Zero = 0, #[num_enum(alternatives = [2..=3])] OneTwoThree = 1, #[num_enum(catch_all)] Other(u8) } ``` And got following error: ``` error:...
Now when using `#[num_enum(default)]` or `#[num_enum(default)]` with `TryFromPrimitive` it just ignores them. But it's more reasonable to return error because of missing support.
For enum ``` #[derive(Copy, Clone, PartialEq, Eq, Debug,IntoPrimitive)] #[repr(u8)] enum ReadCommandMajorSerial { Major0 = 0, Major1(ReadCommandMajor1MinorSerial) = 1, Major2 = 2, } #[derive(Copy, Clone, PartialEq, Eq, Debug, IntoPrimitive)] #[repr(u8)] enum...
Add a `#[num_enum(crate = ..)]` attribute, which lets the user set where the num_enum crate is located.
Adding `#[num_enum(catch_all)]` to an enum variant removes the enum's display name while debugging. When a known enum variant occurs, instead of the name, `{...}` is shown signifying debug information is...
I am curious if you would be interested in providing a derive implementation to allow `AsRef`. I have found when attempting to use this crate with some of the standard...
I'm often running into a case where I'd want to derive discriminant on arbitrary enums. It's even more useful nowadays now that arbitrary_enum_discriminants are stabilized in Rust, so you can...
Useful when num_enum is being reexported from another crate, because otherwise I get: ``` Warning: Could not find `num_enum` in `dependencies` or `dev-dependencies` in `Cargo.toml`! => defaulting to `num_enum` ```...