pub struct WithinRange<T>{ /* private fields */ }
Expand description
A Range
implementation to verify a value is between two reference values
Implementations§
Source§impl<T: Debug + Display + Clone + PartialOrd> WithinRange<T>
impl<T: Debug + Display + Clone + PartialOrd> WithinRange<T>
Sourcepub const fn new(lower_bound: T, upper_bound: T) -> Self
pub const fn new(lower_bound: T, upper_bound: T) -> Self
Creates a new WithinRange
, which is implemented as the union of a LessThanValue<T>
and a GreaterThanValue<T>
.
Somewhat confusingly, lower_bound
and upper_bound
are the first two INVALID values
bounding this range.
Sourcepub fn lower_bound(&self) -> &GreaterThanValue<T>
pub fn lower_bound(&self) -> &GreaterThanValue<T>
Returns the lower bound of this range
Sourcepub fn upper_bound(&self) -> &LessThanValue<T>
pub fn upper_bound(&self) -> &LessThanValue<T>
Returns the upper bound of this range
Trait Implementations§
Source§impl<T> Clone for WithinRange<T>
impl<T> Clone for WithinRange<T>
Source§fn clone(&self) -> WithinRange<T>
fn clone(&self) -> WithinRange<T>
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<T> Debug for WithinRange<T>
impl<T> Debug for WithinRange<T>
Source§impl<T: Debug + Display + Clone + PartialOrd> Range<T> for WithinRange<T>
impl<T: Debug + Display + Clone + PartialOrd> Range<T> for WithinRange<T>
type Error = OutsideRangeError<T>
Source§fn value_is_valid(&self, value: &T) -> bool
fn value_is_valid(&self, value: &T) -> bool
Returns true if the value is valid for the specified range
Auto Trait Implementations§
impl<T> Freeze for WithinRange<T>where
T: Freeze,
impl<T> RefUnwindSafe for WithinRange<T>where
T: RefUnwindSafe,
impl<T> Send for WithinRange<T>where
T: Send,
impl<T> Sync for WithinRange<T>where
T: Sync,
impl<T> Unpin for WithinRange<T>where
T: Unpin,
impl<T> UnwindSafe for WithinRange<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