#![warn(missing_docs)]
mod bound;
mod bounded_range;
mod bounded_set;
mod complement;
mod empty_range;
mod implementations;
mod intersection;
mod lower_bounded_range;
mod lower_bounded_set;
mod step;
#[cfg(test)]
mod test;
mod unbounded_range;
mod unbounded_set;
mod union;
mod upper_bounded_range;
mod upper_bounded_set;
pub use self::{
bound::*, bounded_range::*, bounded_set::*, complement::*, empty_range::*, intersection::*,
lower_bounded_range::*, lower_bounded_set::*, step::*, unbounded_range::*, unbounded_set::*,
union::*, upper_bounded_range::*, upper_bounded_set::*,
};
pub trait Rangetools {
fn is_empty(&self) -> bool;
fn complement<Output>(self) -> Output
where
Self: Sized + RangeComplement<Output>,
{
RangeComplement::complement(self)
}
type Inner;
fn to_inner(self) -> Self::Inner;
fn intersection<R, Output>(self, other: R) -> Output
where
R: Rangetools,
Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,
{
RangeIntersection::intersection(self, other)
}
fn disjoint<R, Output>(self, other: R) -> bool
where
R: Rangetools,
Output: Rangetools,
Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,
{
Rangetools::intersection(self, other).is_empty()
}
fn intersects<R, Output>(self, other: R) -> bool
where
R: Rangetools,
Output: Rangetools,
Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,
{
!self.disjoint(other)
}
type Set;
fn to_set(self) -> Self::Set;
fn union<R, Output>(self, other: R) -> Output
where
R: Rangetools,
Self: Sized + RangeUnion<R, R::Set, Output = Output>,
{
RangeUnion::union(self, other)
}
}