use-interval 0.0.6

Small interval and bound primitives for RustUse
Documentation
  • Coverage
  • 100%
    35 out of 35 items documented3 out of 23 items with examples
  • Size
  • Source code size: 18.63 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 540.07 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 32s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-math
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-interval

Install

[dependencies]
use-interval = "0.0.5"

What belongs here

use-interval owns reusable interval and bound primitives. It provides open, closed, half-open, and unbounded intervals together with small operations such as containment, overlap, emptiness checks, and intersection.

The crate stays intentionally narrow and dependency-free so adjacent crates can reuse interval semantics without pulling in domain-specific policy.

Neighboring crates

Crate Responsibility
use-interval Generic interval and bound primitives
use-real Real-number abstractions, validated finite values, and comparisons
use-calculus Numerical methods that may consume intervals
use-probability Probability-specific interval interpretations
use-statistics Statistical confidence intervals and descriptive interpretation
use-geometry Geometry-specific bounds, boxes, and spatial interval compositions
use-optimization Optimization algorithms and interval-based search strategies

use-interval intentionally does not define confidence interval types, geometry-specific bounding boxes, unit-aware intervals, or equation-solving algorithms.

Examples

Containment

use use_interval::Interval;

let interval = Interval::closed(1.0, 3.0);

assert!(interval.contains(1.0));
assert!(interval.contains(2.0));
assert!(interval.contains(3.0));
assert!(!interval.contains(4.0));

Overlap and excluded endpoints

use use_interval::Interval;

let left = Interval::closed(1.0, 3.0);
let right = Interval::open(3.0, 5.0);

assert!(!left.overlaps(&right));
assert_eq!(left.intersection(&right), None);

Intersection with an included shared endpoint

use use_interval::Interval;

let left = Interval::closed(1.0, 3.0);
let right = Interval::closed(3.0, 5.0);

assert!(left.overlaps(&right));
assert_eq!(left.intersection(&right), Some(Interval::closed(3.0, 3.0)));

Status

use-interval is a concrete pre-1.0 crate in the RustUse math workspace. The API stays explicit and conservative so crates like use-real, use-calculus, use-probability, and use-optimization can share one small interval vocabulary without inheriting domain-specific abstractions.