int-interval-set 0.3.0

Integer half-open interval set structures built on top of int-interval.
Documentation
use super::*;

impl<I: IntCO> IntCOSet<I> {
    /// Returns the number of canonical intervals.
    #[inline]
    pub fn interval_count(&self) -> usize {
        self.intervals.len()
    }

    /// Returns whether the set contains no intervals.
    #[inline]
    pub fn is_empty(&self) -> bool {
        self.intervals.is_empty()
    }

    /// Returns the canonical interval slice.
    ///
    /// The returned slice is sorted, non-overlapping, and contains no
    /// adjacent intervals.
    #[inline]
    pub fn as_slice(&self) -> &[I] {
        &self.intervals
    }

    /// Iterates over canonical intervals by value.
    #[inline]
    pub fn iter_intervals(&self) -> impl Iterator<Item = I> + '_ {
        self.intervals.iter().copied()
    }
}

#[cfg(test)]
mod tests;