[−][src]Trait range_check::Check
Trait that provides early returns for failed range checks using the
Result
type.
Required methods
fn check_range(self, range: R) -> Result<Self, OutOfRangeError<Self>>
Checks whether self
is within the given range. If it is, re-returns
self
. Otherwise, returns an Error
that contains both the value and
the range.
Examples
use range_check::Check; assert!(24680.check_range(1..99999).is_ok()); assert!(24680.check_range(1..9999).is_err());
Implementors
impl<T, R> Check<R> for T where
R: RangeBounds<T>,
T: PartialOrd + Copy,
[src]
R: RangeBounds<T>,
T: PartialOrd + Copy,