Crate interval[][src]

Expand description

This library proposes structures for interval arithmetic, most set operations are implemented.

Overflow behavior

Nothing special is done against overflow beside the checks done by Rust in debug mode for arithmetic overflows.


Interval bounds must implement, for most operations, the Width trait. This is because the maximum size of an n-bits interval can not fit in an n-bits integer. Consider the interval [0..1] with 1-bit bounds, the size 2 can not be represented with only one bit. It needs n+1 bits, and this is problematic with the largest primitive types such as u64. Therefore, the interval bounds must be used within the limits of Width::min_value() and Width::max_value(), and not by the limits provided by num::traits::Bounded.


For examples see the interval module, interval set module.



pub use crate::interval::Interval;
pub use crate::interval_set::IntervalSet;


Closed and bounded generic interval.

Closed and bounded generic interval set.

Interval and bound specific operations.