4 releases
0.1.3 | Jun 24, 2024 |
---|---|
0.1.2 | Jun 18, 2024 |
0.1.1 | Jun 16, 2024 |
0.1.0 | Jun 16, 2024 |
#715 in Encoding
191 downloads per month
11KB
192 lines
interva
A feature-rich crate for handling intervals.
Example
use interva::Interval;
// proper-subset
assert!(Interval::closed(1, 2) > Interval::open(1, 2));
// subset
assert!(Interval::<i32>::EMPTY <= Interval::EMPTY); // `i32`'s here just because type inference failed
// intersection
assert!(Interval::closed(1, 3) * Interval::open(2, 4) == Interval::lorc(2, 3)); // `lorc` for "left-open-right-closed"
// use `/` to judge whether contains certain element
assert!(Interval::closed(1.5, 1.7) / 1.7);
assert!(!(Interval::open(1.5, 1.7) / 1.7));
Features
serde
for optional serialization support.
Dependencies
~160KB