pub struct Range<T> {
pub start: T,
pub end: T,
}
Fields§
§start: T
§end: T
Implementations§
Source§impl<T: PartialOrd> Range<T>
impl<T: PartialOrd> Range<T>
Source§impl<T: NumericRangeBound> Range<T>
impl<T: NumericRangeBound> Range<T>
pub fn len(&self) -> T
Sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Shrink the length of this range by one element from the front, returning the first item in the range.
Sourcepub fn pop_back(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
Shrink the length of this range by one element from the end, returning the last item in the range.
Sourcepub fn shrink_front(&mut self, n: T)
pub fn shrink_front(&mut self, n: T)
Shrink this range by advancing the start of the range n
elements, i.e. (start + n)..end
NOTE: This function will saturate to self.end
to ensure the range remains valid.
Trait Implementations§
Source§impl From<SourceSpan> for Range<usize>
impl From<SourceSpan> for Range<usize>
Source§fn from(span: SourceSpan) -> Self
fn from(span: SourceSpan) -> Self
Converts to this type from the input type.
Source§impl<T: Ord> Ord for Range<T>
impl<T: Ord> Ord 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>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more