Macro 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.
BoundedInteger
Into<Self::Repr>
Add<Self>
Add<Self::Repr>
Sub<Self>
Sub<Self::Repr>
Mul<Self>
Mul<Self::Repr>
Div<Self>
Div<Self::Repr>
Rem<Self>
Rem<Self::Repr>
Neg
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);