Module set

Module set 

Source
Expand description

§Interval Set Operations Module

This module provides implementations for interval set operations through the IntervalSet type, which manages collections of AtomicIntervals and supports various set operations.

§Main Types

  • IntervalSet<T>: A collection of atomic intervals supporting set operations

§Operations

The module supports these primary set operations:

  • Union: Combines intervals, merging overlapping or adjacent ones
  • Intersection: Finds common regions between intervals
  • Difference: Computes regions present in one interval but not another

§Example

use timekeep_rs::{IntervalSet, AtomicInterval};

// Create two intervals
let a = IntervalSet::from(AtomicInterval::closed(1, 5));
let b = IntervalSet::from(AtomicInterval::closed(3, 7));

// Perform set operations
let union = a.union(&b);                    // Results in [1, 7]
let intersection = a.intersection(&b);       // Results in [3, 5]
let difference = a.difference(&b);          // Results in [1, 3)

§Type Parameters

  • T: Represents the boundary type for intervals

Structs§

IntervalSet