#ranged #numbers #num #compile-time #range #value #hold

ranged-num

A package for typing numbers in a compile-time known range

2 releases

0.1.1 Nov 25, 2020
0.1.0 Nov 25, 2020

#4 in #ranged

MIT license

19KB
353 lines

ranged-num is a crate for representing a single number that is in some compile-time known range of values. You can use any underlying numeric type to hold the actual value. The main type to look at is Ranged.

Example:

use typenum::{N2, P3, P4};
use ranged_num::Ranged;

let ranged = Ranged::<N2, P4, isize>::new::<P3>();
assert_eq!(ranged.value(), 3);

lib.rs:

ranged-num is a crate for representing a single number that is in some compile-time known range of values. You can use any underlying numeric type to hold the actual value. The main type to look at is Ranged.

Example:

use typenum::{N2, P3, P4};
use ranged_num::Ranged;

let ranged = Ranged::<N2, P4, isize>::new::<P3>();
assert_eq!(ranged.value(), 3);

Dependencies

~155KB