Crate interval

source ·
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.

Limits

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.

Examples

For examples see the interval module, interval set module.

References

Re-exports

Modules

  • Closed and bounded generic interval.
  • Closed and bounded generic interval set.
  • Interval and bound specific operations.