Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable way to decl enums tag #1

Open
Frago9876543210 opened this issue Jun 11, 2020 · 1 comment
Open

Stable way to decl enums tag #1

Frago9876543210 opened this issue Jun 11, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@Frago9876543210
Copy link
Owner

Frago9876543210 commented Jun 11, 2020

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 Frago9876543210 added the enhancement New feature or request label Jun 13, 2020
@Frago9876543210 Frago9876543210 changed the title Derive for enums Stable way to decl enums tag Aug 10, 2020
@Frago9876543210
Copy link
Owner Author

Frago9876543210 commented Aug 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant