odsek 0.1.0

Lazy, pull-based composition of mathematical interval sets with open/closed endpoints, no_std-compatible.
Documentation
//! Intersect two interval sets.
//!
//! Run with: `cargo run --example intersection`

use odsek::*;

fn main() {
    // [1, 3] tagged "A"
    let ia = Interval::new(EndpointOC::Closed(1), EndpointOC::Closed(3), "A");
    // (2, 4) tagged "B"
    let ib = Interval::new(EndpointOC::Open(2), EndpointOC::Open(4), "B");

    let isa = IntervalsSingle::new(ia);
    let isb = IntervalsSingle::new(ib);

    // Intersection: (2, 3] tagged ("A", "B")
    let result = and(isa, isb).into_iter().collect::<Vec<_>>();

    for iv in &result {
        println!("{:?}", iv);
    }

    assert_eq!(result.len(), 1);
    assert_eq!(
        result[0],
        Interval::new(EndpointOC::Open(2), EndpointOC::Closed(3), ("A", "B"))
    );
}