-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
It would be beneficial to be able to derive Encode and Decode for primitive enums (C-like enums) with a specified repr:
#[derive(Encode, Decode)]
#[repr(u8)]
enum States {
Starting = 0,
Idle = 1,
Active = 2,
}Currently, the derive only works for structs and internally panics on simple enums.
There's some difficulties here:
- Complex enums could theoretically be supported by treating internal enum data as a struct, but this starts getting into the land of "how do we specify exactly how data should be laid out"
- What happens if the user doesn't specify a repr? Do we default to e.g. u32?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels