bpci/interval.rs
1//! Interval trait and structures.
2
3pub mod bounded;
4pub mod centered;
5
6pub use self::bounded::*;
7pub use self::centered::*;
8
9pub trait Interval<F>: PartialOrd<Self> + PartialOrd<F> {
10    /// Returns the interval's mean.
11    #[must_use]
12    fn mean(&self) -> F;
13
14    /// Returns the interval's margin.
15    #[must_use]
16    fn margin(&self) -> F;
17
18    /// Returns the interval's lower bound.
19    #[must_use]
20    fn lower(&self) -> F;
21
22    /// Returns the interval's upper bound.
23    #[must_use]
24    fn upper(&self) -> F;
25
26    /// Returns the interval's bounds as a 2-tuple.
27    #[must_use]
28    fn bounds(&self) -> (F, F);
29
30    /// Returns whether the interval contains the specified point.
31    #[must_use]
32    fn contains(&self, point: F) -> bool;
33}