pub struct OutOfRangeError<T> {
pub allowed_range: Bounds<T>,
pub outside_value: T,
}
Expand description
The error that gets thrown when a check_range
fails.
Fields§
§allowed_range: Bounds<T>
The bounds of the range that was searched.
outside_value: T
The value that lies outside of the range.
Implementations§
Source§impl<T> OutOfRangeError<T>
impl<T> OutOfRangeError<T>
Sourcepub fn generify<U: From<T>>(self) -> OutOfRangeError<U>
pub fn generify<U: From<T>>(self) -> OutOfRangeError<U>
Converts this error to an error with the same values as another type.
The other type must be From
-convertible from this one.
§Examples
use range_check::{Check, OutOfRangeError};
let err: OutOfRangeError<i16> = 24680.check_range(1..9999).unwrap_err();
let err: OutOfRangeError<i32> = err.generify();
Trait Implementations§
Source§impl<T: Clone> Clone for OutOfRangeError<T>
impl<T: Clone> Clone for OutOfRangeError<T>
Source§fn clone(&self) -> OutOfRangeError<T>
fn clone(&self) -> OutOfRangeError<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> Debug for OutOfRangeError<T>
impl<T: Debug> Debug for OutOfRangeError<T>
Source§impl<T: Debug> Display for OutOfRangeError<T>
impl<T: Debug> Display for OutOfRangeError<T>
Source§impl<T: Debug> Error for OutOfRangeError<T>
impl<T: Debug> Error for OutOfRangeError<T>
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
Source§impl<T: PartialEq> PartialEq for OutOfRangeError<T>
impl<T: PartialEq> PartialEq for OutOfRangeError<T>
impl<T> StructuralPartialEq for OutOfRangeError<T>
Auto Trait Implementations§
impl<T> Freeze for OutOfRangeError<T>where
T: Freeze,
impl<T> RefUnwindSafe for OutOfRangeError<T>where
T: RefUnwindSafe,
impl<T> Send for OutOfRangeError<T>where
T: Send,
impl<T> Sync for OutOfRangeError<T>where
T: Sync,
impl<T> Unpin for OutOfRangeError<T>where
T: Unpin,
impl<T> UnwindSafe for OutOfRangeError<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