#integer #int #cmp #compare #signed-integer #unsigned-integer

int_cmp

Small library for comparing unsigned integers with signed integers

3 unstable releases

0.2.1 Oct 5, 2020
0.2.0 Oct 5, 2020
0.1.0 Oct 4, 2020

#1699 in Algorithms

MIT license

13KB
288 lines

int_cmp Crates.io

Rust Integer Types Comparison Library

Example

use int_cmp::IntCmp;

let a = -25_i8;
let b = 64_u8;
assert!(a.cmp_lt(b));

let x = -45000_i32;
let y = 2560000_u64;
assert!(x.cmp_ne(y));

Changelog

  • Added support for usize

Contributing

Any Pull Request is welcome, however small your contribution may be!


lib.rs:

Allow for comparisons between an unsigned integer and a signed integer

Example

use int_cmp::IntCmp;

let a = -25_i8;
let b = 64_u8;
assert!(a.cmp_lt(b));

let x = -45000_i32;
let y = 2560000_u64;
assert!(x.cmp_ne(y));

No runtime deps