pub struct Interval<T> {
pub start: T,
pub end: T,
}Expand description
A (half-open) interval bounded inclusively below and either exclusively or inclusively above.
- exclusively above (
start..end) in discrete domains. - inclusively above (
start..=end) in continuous domains.
The interval Interval { start, end } contains all values with start <= x < end,
if T is a discrete domain, or start <= x <= end, if T is a continuous domain.
It is empty if start >= end, if T is a discrete domain,
or start > end if T is a continuous domain.
Fields§
§start: TThe lower bound of the interval (inclusive).
end: TThe upper bound of the interval (exclusive, or inclusive).
Trait Implementations§
impl<T: Copy> Copy for Interval<T>
impl<T: Eq> Eq for Interval<T>
Source§impl<T> From<RangeInclusive<T>> for Interval<T>where
T: Copy,
impl<T> From<RangeInclusive<T>> for Interval<T>where
T: Copy,
Source§fn from(value: RangeInclusive<T>) -> Self
fn from(value: RangeInclusive<T>) -> Self
Converts to this type from the input type.
Source§impl<T> FromIntervals<Interval<T>, IntervalFrom<T>> for Relation
impl<T> FromIntervals<Interval<T>, IntervalFrom<T>> for Relation
Source§fn from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<IntervalFrom<T>>,
) -> Self
fn from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalFrom<T>>, ) -> Self
Creates a value from a pair of intervals.
Source§impl<T> FromIntervals<Interval<T>, IntervalFull> for Relation
impl<T> FromIntervals<Interval<T>, IntervalFull> for Relation
Source§fn from_intervals(s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalFull>) -> Self
fn from_intervals(s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalFull>) -> Self
Creates a value from a pair of intervals.
Source§impl<T> FromIntervals<Interval<T>, IntervalTo<T>> for Relation
impl<T> FromIntervals<Interval<T>, IntervalTo<T>> for Relation
Source§fn from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<IntervalTo<T>>,
) -> Self
fn from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalTo<T>>, ) -> Self
Creates a value from a pair of intervals.
Source§impl<T> FromIntervals<IntervalFrom<T>, Interval<T>> for Relation
impl<T> FromIntervals<IntervalFrom<T>, Interval<T>> for Relation
Source§fn from_intervals(
s: &NonEmpty<IntervalFrom<T>>,
t: &NonEmpty<Interval<T>>,
) -> Self
fn from_intervals( s: &NonEmpty<IntervalFrom<T>>, t: &NonEmpty<Interval<T>>, ) -> Self
Creates a value from a pair of intervals.
Source§impl<T> FromIntervals<IntervalFull, Interval<T>> for Relation
impl<T> FromIntervals<IntervalFull, Interval<T>> for Relation
Source§fn from_intervals(s: &NonEmpty<IntervalFull>, t: &NonEmpty<Interval<T>>) -> Self
fn from_intervals(s: &NonEmpty<IntervalFull>, t: &NonEmpty<Interval<T>>) -> Self
Creates a value from a pair of intervals.
Source§impl<T> FromIntervals<IntervalTo<T>, Interval<T>> for Relation
impl<T> FromIntervals<IntervalTo<T>, Interval<T>> for Relation
Source§fn from_intervals(
s: &NonEmpty<IntervalTo<T>>,
t: &NonEmpty<Interval<T>>,
) -> Self
fn from_intervals( s: &NonEmpty<IntervalTo<T>>, t: &NonEmpty<Interval<T>>, ) -> Self
Creates a value from a pair of intervals.
Source§impl<T> IntervalBounds<T> for Interval<T>where
T: Copy,
impl<T> IntervalBounds<T> for Interval<T>where
T: Copy,
Source§impl<T: PartialEq> PartialEq for Interval<T>
impl<T: PartialEq> PartialEq for Interval<T>
impl<T> StructuralPartialEq for Interval<T>
Source§impl<T> TryFromIntervals<Interval<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<Interval<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<Interval<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<Interval<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<Interval<T>, IntervalFrom<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<Interval<T>, IntervalFrom<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<IntervalFrom<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalFrom<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<Interval<T>, IntervalFull> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<Interval<T>, IntervalFull> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<IntervalFull>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalFull>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<Interval<T>, IntervalTo<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<Interval<T>, IntervalTo<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<Interval<T>>,
t: &NonEmpty<IntervalTo<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<Interval<T>>, t: &NonEmpty<IntervalTo<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<IntervalFrom<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<IntervalFrom<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<IntervalFrom<T>>,
t: &NonEmpty<Interval<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<IntervalFrom<T>>, t: &NonEmpty<Interval<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<IntervalFull, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<IntervalFull, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<IntervalFull>,
t: &NonEmpty<Interval<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<IntervalFull>, t: &NonEmpty<Interval<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Source§impl<T> TryFromIntervals<IntervalTo<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
impl<T> TryFromIntervals<IntervalTo<T>, Interval<T>> for Relationwhere
T: PartialOrd + Copy,
Source§fn try_from_intervals(
s: &NonEmpty<IntervalTo<T>>,
t: &NonEmpty<Interval<T>>,
) -> Result<Self, IntervalError>
fn try_from_intervals( s: &NonEmpty<IntervalTo<T>>, t: &NonEmpty<Interval<T>>, ) -> Result<Self, IntervalError>
Creates a value from a pair of intervals.
Auto Trait Implementations§
impl<T> Freeze for Interval<T>where
T: Freeze,
impl<T> RefUnwindSafe for Interval<T>where
T: RefUnwindSafe,
impl<T> Send for Interval<T>where
T: Send,
impl<T> Sync for Interval<T>where
T: Sync,
impl<T> Unpin for Interval<T>where
T: Unpin,
impl<T> UnsafeUnpin for Interval<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Interval<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more