pub struct Range<T> {
pub start: T,
pub end: T,
}
Expand description
A range of elements, including the endpoints.
Fields§
§start: T
§end: T
Implementations§
Source§impl<T: PrimInt> Range<T>
impl<T: PrimInt> Range<T>
Sourcepub fn new(start: T, end: T) -> Range<T>
pub fn new(start: T, end: T) -> Range<T>
Creates a new range with the given start and endpoints (inclusive).
§Panics
- if
start
is strictly larger thanend
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Checks whether the intersections overlap.
Sourcepub fn intersection(&self, other: &Self) -> Option<Self>
pub fn intersection(&self, other: &Self) -> Option<Self>
Computes the intersection between two ranges. Returns none if the intersection is empty.
Trait Implementations§
Source§impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
Source§fn from_iter<I: IntoIterator<Item = Range<T>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Range<T>>>(iter: I) -> Self
Builds a RangeSet
from an iterator over Range
s.
Source§impl<T: Ord> Ord for Range<T>
impl<T: Ord> Ord for Range<T>
Source§impl<T: PrimInt> PartialOrd<T> for Range<T>
impl<T: PrimInt> PartialOrd<T> for Range<T>
Source§impl<T: PartialOrd> PartialOrd for Range<T>
impl<T: PartialOrd> PartialOrd for Range<T>
impl<T: Copy> Copy for Range<T>
impl<T: Eq> Eq for Range<T>
impl<T> StructuralPartialEq for Range<T>
Auto Trait Implementations§
impl<T> Freeze for Range<T>where
T: Freeze,
impl<T> RefUnwindSafe for Range<T>where
T: RefUnwindSafe,
impl<T> Send for Range<T>where
T: Send,
impl<T> Sync for Range<T>where
T: Sync,
impl<T> Unpin for Range<T>where
T: Unpin,
impl<T> UnwindSafe for Range<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