pub struct Range<T> {
pub start: Bound<T>,
pub end: Bound<T>,
}Expand description
A range type that can represent all std range types and be serialized.
This type implements conversion operations from all range types defined in
std.
Fields§
§start: Bound<T>The start of the range.
end: Bound<T>The end of the range.
Implementations§
Source§impl<T> Range<T>
impl<T> Range<T>
Sourcepub fn after(self, excluded_start: T) -> Self
pub fn after(self, excluded_start: T) -> Self
Sets the start bound of this range to Bound::Excluded with
excluded_start. The range will represent values that are
Ordering::Greater than, but not
including, excluded_start.
Sourcepub fn start_at(self, included_start: T) -> Self
pub fn start_at(self, included_start: T) -> Self
Sets the start bound of this range to Bound::Included with
included_start. The range will represent values that are
Ordering::Greater than or
Ordering::Equal to included_start.
Sourcepub fn before(self, excluded_end: T) -> Self
pub fn before(self, excluded_end: T) -> Self
Sets the end bound of this range to Bound::Excluded with
excluded_end. The range will represent values that are
Ordering::Less than, but not including,
excluded_end.
Sourcepub fn end_at(self, included_end: T) -> Self
pub fn end_at(self, included_end: T) -> Self
Sets the end bound of this range to Bound::Included with
included_end. The range will represent values that are
Ordering:::Less than or
Ordering::Equal to included_end.
Sourcepub fn map<U, F: Fn(T) -> U>(self, map: F) -> Range<U>
pub fn map<U, F: Fn(T) -> U>(self, map: F) -> Range<U>
Maps each contained value with the function provided.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Range<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Range<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T: Clone> From<RangeInclusive<T>> for Range<T>
impl<T: Clone> From<RangeInclusive<T>> for Range<T>
Source§fn from(range: RangeInclusive<T>) -> Self
fn from(range: RangeInclusive<T>) -> Self
Source§impl<T> From<RangeToInclusive<T>> for Range<T>
impl<T> From<RangeToInclusive<T>> for Range<T>
Source§fn from(range: RangeToInclusive<T>) -> Self
fn from(range: RangeToInclusive<T>) -> Self
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
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>
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>
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