1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: Apache-2.0

//! This crate contains types for measuring linear sets by either the end
//! points (`Line`) or by a starting point and the number of elements (`Span`).
//!
//! In the interest of zero-cost abstractions, all methods are always inlined
//! for maximum compiler optimization. Thus, you only pay for the conversions
//! that are actually used.

#![no_std]
#![deny(clippy::all)]
#![deny(missing_docs)]

mod line;
mod span;

pub use crate::line::Line;
pub use crate::span::Span;

/// Determines whether a set contains an element
pub trait Contains<T> {
    /// Returns whether or not the set contains the element
    fn contains(&self, value: &T) -> bool;
}

/// A trait for determining whether a set is empty
pub trait Empty {
    /// Returns whether or not the set is empty
    fn is_empty(&self) -> bool;
}

/// Splits the set
pub trait Split<T>: Sized {
    /// Splits the set
    ///
    /// Returns `None` if `at` is not in the set.
    fn split(self, at: T) -> Option<(Self, Self)>;
}