1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use unconst::unconst; use crate::traits::Integral; #[unconst] impl const Integral for u8 { const MIN: Self = 0; const MAX: Self = 255; fn succ(self) -> Self { self.checked_add(1).unwrap() } fn pred(self) -> Self { self.checked_sub(1).unwrap() } }