bounded_integer::bounded_integer_impls! [] [src]

macro_rules! bounded_integer_impls {
    ($ty:ty, $repr:ty, $min:path, $max:path) => { ... };
}

Implements all bounded integer traits for a C-like enum with contiguous variants.

Examples

#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
enum TwoBit { Z0, P1, P2, P3 }
bounded_integer_impls!(TwoBit, u8, TwoBit::Z0, TwoBit::P3);