-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Description
Description
Add a crate_path option to the EnumInfo struct to allow patterns where other crates can reexport num_enum and allow consumers of their library to consume the From* macros without a direct dependency on the num_enum crate.
num_enum/num_enum_derive/src/parsing.rs
Lines 13 to 18 in 7138fc6
| pub(crate) struct EnumInfo { | |
| pub(crate) name: Ident, | |
| pub(crate) repr: Ident, | |
| pub(crate) variants: Vec<VariantInfo>, | |
| pub(crate) error_type_info: ErrorType, | |
| } |
I'm happy to open a PR if this is something you're happy to use.
Example
use other_crate::num_num::IntoPrimitive;
use other_crate::num_num::TryFromPrimitive;
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, IntoPrimitive, TryFromPrimitive)]
#[num_enum(crate_path = ::other_crate::num_enum)]
pub enum MyEnum {
A = 0,
B = 1,
C = 2,
}Metadata
Metadata
Assignees
Labels
No labels