pub struct Interval<T> {
pub start: T,
pub stop: T,
}Expand description
A closed interval [start, stop] with inclusive bounds.
Represents a continuous range of values from start to stop, where both endpoints are included.
Useful for representing time windows, altitude bands, or coordinate ranges in flight planning.
§Generic Parameters
T: Any type implementingOrdand numeric operations (e.g.,i32,DateTime,f64)
§Fields
start: Inclusive start of the intervalstop: Inclusive end of the interval
§Operations
- Union (
+): Combine overlapping or adjacent intervals - Difference (
-): Subtract an interval (creates gaps) - Intersection (
&): Find overlapping regions
§Examples
ⓘ
use thrust::intervals::Interval;
let flight_level_1 = Interval { start: 250, stop: 350 }; // FL250–FL350
let flight_level_2 = Interval { start: 350, stop: 450 }; // FL350–FL450
// Union: creates a single merged interval if adjacent
let merged = &flight_level_1 + &flight_level_2;
// Difference: removes the intersection
let remainder = flight_level_1 - Interval { start: 300, stop: 400 };Fields§
§start: T§stop: TImplementations§
Trait Implementations§
Source§impl<T> Add<&Interval<T>> for &IntervalCollection<T>
impl<T> Add<&Interval<T>> for &IntervalCollection<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<&Interval<T>> for IntervalCollection<T>
impl<T> Add<&Interval<T>> for IntervalCollection<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<&IntervalCollection<T>> for &Interval<T>
impl<T> Add<&IntervalCollection<T>> for &Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§fn add(self, other: &IntervalCollection<T>) -> IntervalCollection<T>
fn add(self, other: &IntervalCollection<T>) -> IntervalCollection<T>
Performs the
+ operation. Read moreSource§impl<T> Add<Interval<T>> for IntervalCollection<T>
impl<T> Add<Interval<T>> for IntervalCollection<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§impl<T> Add<IntervalCollection<T>> for &Interval<T>
impl<T> Add<IntervalCollection<T>> for &Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§fn add(self, other: IntervalCollection<T>) -> IntervalCollection<T>
fn add(self, other: IntervalCollection<T>) -> IntervalCollection<T>
Performs the
+ operation. Read moreSource§impl<T> Add for &Interval<T>
impl<T> Add for &Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§impl<T> Add for Interval<T>
impl<T> Add for Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
+ operator.Source§impl<T> BitAnd<&Interval<T>> for &IntervalCollection<T>
impl<T> BitAnd<&Interval<T>> for &IntervalCollection<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
& operator.Source§impl<T> BitAnd<&IntervalCollection<T>> for &Interval<T>
impl<T> BitAnd<&IntervalCollection<T>> for &Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
& operator.Source§fn bitand(self, other: &IntervalCollection<T>) -> IntervalCollection<T>
fn bitand(self, other: &IntervalCollection<T>) -> IntervalCollection<T>
Performs the
& operation. Read moreSource§impl<T: Ord> Ord for Interval<T>
impl<T: Ord> Ord for Interval<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Interval<T>
impl<T: PartialOrd> PartialOrd for Interval<T>
Source§impl<T, Delta> Sub<Interval<T>> for IntervalCollection<T>
impl<T, Delta> Sub<Interval<T>> for IntervalCollection<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
- operator.Source§impl<T, Delta> Sub for Interval<T>
impl<T, Delta> Sub for Interval<T>
Source§type Output = IntervalCollection<T>
type Output = IntervalCollection<T>
The resulting type after applying the
- operator.impl<T: Copy> Copy for Interval<T>
impl<T: Eq> Eq for Interval<T>
impl<T> StructuralPartialEq for Interval<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> CoordinateMetadata for Twhere
T: ?Sized,
impl<T> CoordinateMetadata for Twhere
T: ?Sized,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.