#[derive(Contiguous)]
Expand description
Derive the Contiguous
trait for an enum
The macro ensures that the enum follows all the the safety requirements
for the Contiguous
trait.
The following constraints need to be satisfied for the macro to succeed
- The enum must be
#[repr(Int)]
- The enum must be fieldless
- The enum discriminants must form a contiguous range
ยงExample
#[derive(Copy, Clone, Contiguous)]
#[repr(u8)]
enum Test {
A = 0,
B = 1,
C = 2,
}