Skip to content

derive(CheckedBitPattern) should work on repr-stable enums with fields #166

Closed
@RReverser

Description

@RReverser

repr(C), repr(i*) and repr(u*) enums with fields have had a stable layout for FFI for about 5 years now, and recently arbitrary enum discriminants on enums with fields were stabilized as well.

It would be great to support them in the CheckedBitPattern derive so that examples from that issue could be casted to/from bytes as expected, e.g.:

#[derive(Clone, Copy, CheckedBitPattern)]
#[repr(u8)]
enum Foo {
    A = 0,
    B { a: u16 } = 1,
    C { a: u32, b: u16 } = 2,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions