bounded-integer 0.1.1

Bounded integers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[macro_use]
extern crate bounded_integer;

use bounded_integer::BoundedInteger;

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

// Tests overflow of the representation.
#[test]
fn checked_sub() {
    assert_eq!(None, Bit::Z0.checked_sub(Bit::P1));
}