Skip to main content

IntervalCollection

Struct IntervalCollection 

Source
pub struct IntervalCollection<T> {
    pub elts: Vec<Interval<T>>,
}
Expand description

A collection of disjoint intervals (gaps allowed).

Represents a union of non-overlapping intervals, which can have gaps between them. This is the result of combining, intersecting, or subtracting intervals. The collection is typically kept in sorted order for efficient operations.

§Fields

  • elts: Vector of disjoint intervals in order

§Examples

use thrust::intervals::Interval;

// Two non-adjacent flight level bands (with gap)
let band1 = Interval { start: 250, stop: 350 };
let band2 = Interval { start: 450, stop: 550 };
let collection = band1 + band2;  // Results in IntervalCollection with gap [350–450]

// Calculate total time covered
let total = collection.total_duration();

Fields§

§elts: Vec<Interval<T>>

Implementations§

Source§

impl<T, Delta> IntervalCollection<T>
where T: Sub<T, Output = Delta> + Add<Delta, Output = T> + Copy + PartialOrd, Delta: Copy + Sum,

Source

pub fn total_duration(&self) -> Delta

Trait Implementations§

Source§

impl<T> Add<&Interval<T>> for &IntervalCollection<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Interval<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add<&Interval<T>> for IntervalCollection<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Interval<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add<&IntervalCollection<T>> for &Interval<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &IntervalCollection<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add<Interval<T>> for IntervalCollection<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Interval<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add<IntervalCollection<T>> for &Interval<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: IntervalCollection<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add for &IntervalCollection<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &IntervalCollection<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> Add for IntervalCollection<T>
where T: Ord + Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: IntervalCollection<T>) -> IntervalCollection<T>

Performs the + operation. Read more
Source§

impl<T> BitAnd<&Interval<T>> for &IntervalCollection<T>
where T: Copy + Clone + PartialEq + PartialOrd,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &Interval<T>) -> IntervalCollection<T>

Performs the & operation. Read more
Source§

impl<T> BitAnd<&IntervalCollection<T>> for &Interval<T>
where T: Copy + Clone + PartialEq + PartialOrd,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &IntervalCollection<T>) -> IntervalCollection<T>

Performs the & operation. Read more
Source§

impl<T> BitAnd for &IntervalCollection<T>
where T: Copy + Clone + PartialEq + PartialOrd,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &IntervalCollection<T>) -> IntervalCollection<T>

Performs the & operation. Read more
Source§

impl<T: Debug> Debug for IntervalCollection<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Display for &IntervalCollection<T>
where T: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, Delta> Sub<Interval<T>> for IntervalCollection<T>
where T: Sub<T, Output = Delta> + Add<Delta, Output = T> + Copy + PartialOrd, Delta: Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Interval<T>) -> IntervalCollection<T>

Performs the - operation. Read more
Source§

impl<T, Delta> Sub for IntervalCollection<T>
where T: Sub<T, Output = Delta> + Add<Delta, Output = T> + Copy + PartialOrd, Delta: Copy,

Source§

type Output = IntervalCollection<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: IntervalCollection<T>) -> IntervalCollection<T>

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for IntervalCollection<T>

§

impl<T> RefUnwindSafe for IntervalCollection<T>
where T: RefUnwindSafe,

§

impl<T> Send for IntervalCollection<T>
where T: Send,

§

impl<T> Sync for IntervalCollection<T>
where T: Sync,

§

impl<T> Unpin for IntervalCollection<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for IntervalCollection<T>

§

impl<T> UnwindSafe for IntervalCollection<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CoordinateMetadata for T
where T: ?Sized,

Source§

fn crs_id(&self) -> Option<MdIdentifier>

Source§

fn crs(&self) -> Option<Crs>

Source§

fn coordinate_epoch(&self) -> Option<DataEpoch>

Source§

fn is_valid(&self) -> bool

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more