Stable way to decl enums tag
Frago9876543210 opened this issue · 1 comments
Frago9876543210 commented
stable rust:
#[derive(Io)]
#[endian(default_endian)] //only for Prim
#[repr(Prim)] //u32, i32, ...
enum Packet {
#[tag(0xdeadbeef)]
Foo(type: Io),
}
nightly rust: (WIP: enums branch)
#[derive(Io)]
#[endian(default_endian)] //only for Prim
#[repr(Prim)] //u32, i32, ...
enum Packet {
Foo(type: Io, type1: Prim, ...) = 0xdeadbeef,
}
Frago9876543210 commented
TODO:
- Stable macro for struct-like & tuple enums
- Custom repr types (
#[wrapper(type)]
) - Zero cost write for unit enums? (enum as <repr_ty>)
- More tests