/range-checked

Range checked types leveraging Rust's type system.

Primary LanguageRustMIT LicenseMIT

range-checked

Continuous integration Documentation

range-checked provides range checked types which leverage Rust's type system. Please see docs here.

Example

use range_checked::I32Bounded;

fn main() {
    // Panics
    let _: I32Bounded<0, 128, false> = 128.try_into().unwrap(); 
    // Successful
    let _: I32Bounded<0, 128, true> = 128.try_into().unwrap(); 
    // Successful
    let _: I32Bounded<0, 128, false> = 64.try_into().unwrap(); 
}