Crates.io | ranged-num |
lib.rs | ranged-num |
version | 0.1.1 |
source | src |
created_at | 2020-11-25 09:43:58.517791 |
updated_at | 2020-11-25 18:27:21.00147 |
description | A package for typing numbers in a compile-time known range |
homepage | |
repository | https://github.com/sheyne/ranged-num/ |
max_upload_size | |
id | 316249 |
size | 18,752 |
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);