int-range-ext 0.1.0

A trait that implements some convenience methods for integer ranges
Documentation
  • Coverage
  • 43.75%
    7 out of 16 items documented7 out of 10 items with examples
  • Size
  • Source code size: 21.88 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.19 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • hangj/int-range-ext
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hangj

IntRangeExt

IntRangeExt is a trait that implements some convenience methods for integer ranges. integer types could be: u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize.

Usage example

use int_range_ext::IntRangeExt;

assert_eq!((0..10).to_inclusive(), Ok(0..=9));
assert_eq!((0..).to_inclusive(), Ok(0..=i32::MAX));

assert_eq!((0..10).contains_subrange(&(1..8)), Ok(true));

assert!((0..10).equal(&(0..=9)));
assert!((..).equal(&(0u8..=255)));

assert_eq!((0..10).substract(&(4..=7)), Ok((Some(0..=3), Some(8..=9))));

assert_eq!((0..10).intersect(&(0..=7)), Ok(true));