-
Notifications
You must be signed in to change notification settings - Fork 16
Description
This is not a bug but a request for a new feature. My expectation was that I could use type aliases (e.g., pub type Something = u7) in the same way as other numeric types, on either new #[bitfield] or #[bitenum] types. However, this doesn’t seem possible because the available macros are unable to differentiate these aliases from structs or enums.
I’ve started looking into the code, but I haven’t yet figured out how to implement this. One idea is to add such types to an internal list that can be checked during the parsing phase. Another approach could involve using annotations like #[bittype]. Alternatively, the underlying reflection mechanism might handle this directly, though I’m not familiar enough with Rust’s macro system to determine the best solution. Finally, another possible approach might be to implement the necessary traits, such as those provided by the arbitrary-int crate: I’ve noticed that this crate contains macros that handle type aliases, but unfortunately they don’t seem to be exposed for external use.
I’d be happy to submit a PR if this feature is of interest to others. I’d appreciate any guidance or hints on the best way to approach the implementation. Thanks in advance.