pub struct Interval<I> { /* private fields */ }Expand description
An inclusive interval, only valid intervals can be constructed.
This interval struct is used throughout this crate for the examples and tests but can also be used by library users if they don’t wish to create their own interval types.
To create an InclusiveInterval use one of the various contrutor
functions which will all panic if you try to create an invalid interval.
See Invalid Intervals
for more details.
use nodit::interval::{ee, ii};
let inclusive_interval = ii(4, 4);
let exclusive_interval = ee(3, 5);
assert_eq!(inclusive_interval, exclusive_interval);ⓘ
use nodit::interval::ee;
let invalid_interval = ee(4, 4);Implementations§
Trait Implementations§
source§impl<'de, I> Deserialize<'de> for Interval<I>where
I: Deserialize<'de>,
impl<'de, I> Deserialize<'de> for Interval<I>where
I: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<I> From<Interval<I>> for RangeInclusive<I>
impl<I> From<Interval<I>> for RangeInclusive<I>
source§impl<I> From<RangeInclusive<I>> for Interval<I>where
I: PointType,
impl<I> From<RangeInclusive<I>> for Interval<I>where
I: PointType,
source§fn from(value: RangeInclusive<I>) -> Self
fn from(value: RangeInclusive<I>) -> Self
Converts to this type from the input type.
source§impl<I> InclusiveInterval<I> for Interval<I>where
I: PointType,
impl<I> InclusiveInterval<I> for Interval<I>where
I: PointType,
source§fn contains(&self, point: I) -> boolwhere
I: PointType,
fn contains(&self, point: I) -> boolwhere
I: PointType,
Does the interval contain the given point?
source§fn is_valid(&self) -> boolwhere
I: PointType,
fn is_valid(&self) -> boolwhere
I: PointType,
Is the interval is valid, which according to this crate means
start()
<= end()source§fn touches_ordered(&self, other: &Self) -> boolwhere
I: PointType,
fn touches_ordered(&self, other: &Self) -> boolwhere
I: PointType,
Requires that self comes before other and they don’t overlap
source§fn overlaps_ordered(&self, other: &Self) -> boolwhere
I: PointType,
fn overlaps_ordered(&self, other: &Self) -> boolwhere
I: PointType,
Requires that self comes before other
source§impl<I: PartialEq> PartialEq for Interval<I>
impl<I: PartialEq> PartialEq for Interval<I>
source§impl<I> RangeBounds<I> for Interval<I>where
I: PointType,
impl<I> RangeBounds<I> for Interval<I>where
I: PointType,
impl<I: Copy> Copy for Interval<I>
impl<I: Eq> Eq for Interval<I>
impl<I> StructuralEq for Interval<I>
impl<I> StructuralPartialEq for Interval<I>
Auto Trait Implementations§
impl<I> RefUnwindSafe for Interval<I>where
I: RefUnwindSafe,
impl<I> Send for Interval<I>where
I: Send,
impl<I> Sync for Interval<I>where
I: Sync,
impl<I> Unpin for Interval<I>where
I: Unpin,
impl<I> UnwindSafe for Interval<I>where
I: 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