interva

Crates.iointerva
lib.rsinterva
version0.1.3
sourcesrc
created_at2024-06-16 10:35:20.309502
updated_at2024-06-24 09:48:30.910792
descriptionA feature-rich crate for handling intervals.
homepagehttps://github.com/misaka10987/interva
repositoryhttps://github.com/misaka10987/interva
max_upload_size
id1273426
size11,786
misaka10987 (misaka10987)

documentation

https://github.com/misaka10987/interva

README

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.

Commit count: 6

cargo fmt