Struct space_partitioning::interval_tree::Interval [−][src]
pub struct Interval<T> where
T: IntervalType, {
pub start: T,
pub end: T,
}
Expand description
Structure to represent an interval.
Fields
start: T
end: T
Implementations
Constructs a new interval.
Example
use space_partitioning::interval_tree::Interval;
let interval = Interval::new(-2.0, 10.0);
assert_eq!(interval.start, -2.0);
assert_eq!(interval.end, 10.0);
Checks whether the current interval overlaps with another one.
Example
use space_partitioning::interval_tree::Interval;
let interval = Interval::from(-2.0..=10.0);
assert!(interval.overlaps_with(&(0.0..=2.0).into()));
assert!(!interval.overlaps_with(&(20.0..=30.0).into()));
Trait Implementations
Constructs an interval from a `&RangeInclusive
Example
use space_partitioning::interval_tree::Interval;
let range = -2.0..=10.0;
let interval: Interval<_> = (&range).into();
assert_eq!(interval.start, -2.0);
assert_eq!(interval.end, 10.0);
Constructs an interval from a `RangeInclusive
Example
use space_partitioning::interval_tree::Interval;
let interval: Interval<_> = (-2.0..=10.0).into();
assert_eq!(interval.start, -2.0);
assert_eq!(interval.end, 10.0);
assert_eq!(interval, Interval::from(-2.0..=10.0));
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Interval<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Interval<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more