pub struct ReversibleRange<S: Numeric> {
pub start: S,
pub end: S,
}Expand description
An inclusive total range that can be used in reverse order
Fields§
§start: SThe starting point of the range Does not need to be < end
end: SThe ending point of the range Does not need to be > start
Implementations§
Source§impl<S: Numeric> ReversibleRange<S>
impl<S: Numeric> ReversibleRange<S>
Sourcepub const fn new(from: S, to: S) -> Self
pub const fn new(from: S, to: S) -> Self
Create a new range from a start and end value The values do not need to be in order
Sourcepub fn contains(&self, value: S) -> bool
pub fn contains(&self, value: S) -> bool
Check if the range contains the given value Returns true if value is between the start and end values
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the range is empty Returns true if the start and end values are the same
Sourcepub fn is_reversed(&self) -> bool
pub fn is_reversed(&self) -> bool
Check if the range is reversed Returns true if the start value is greater than the end value
Trait Implementations§
Source§impl<S: Clone + Numeric> Clone for ReversibleRange<S>
impl<S: Clone + Numeric> Clone for ReversibleRange<S>
Source§fn clone(&self) -> ReversibleRange<S>
fn clone(&self) -> ReversibleRange<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Numeric> From<RangeInclusive<S>> for ReversibleRange<S>
impl<S: Numeric> From<RangeInclusive<S>> for ReversibleRange<S>
Source§fn from(range: RangeInclusive<S>) -> Self
fn from(range: RangeInclusive<S>) -> Self
Converts to this type from the input type.
impl<S: Eq + Numeric> Eq for ReversibleRange<S>
impl<S: Numeric> StructuralPartialEq for ReversibleRange<S>
Auto Trait Implementations§
impl<S> Freeze for ReversibleRange<S>where
S: Freeze,
impl<S> RefUnwindSafe for ReversibleRange<S>where
S: RefUnwindSafe,
impl<S> Send for ReversibleRange<S>where
S: Send,
impl<S> Sync for ReversibleRange<S>where
S: Sync,
impl<S> Unpin for ReversibleRange<S>where
S: Unpin,
impl<S> UnwindSafe for ReversibleRange<S>where
S: 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