Struct overflow_error::CannotDivValue
[−]
[src]
pub struct CannotDivValue<T>(_);
[CannotDiv
] with a payload.
Methods
impl<T> CannotDivValue<T>
[src]
pub fn ignore_inner(&self) -> CannotDiv
[src]
Ignores the would-be-divided value.
Examples
use overflow_error::*; assert!( CannotDiv::ByZero.val(5).ignore_inner() == CannotDiv::ByZero ); assert!( CannotDiv::WouldOverflow.val(5).ignore_inner() == CannotDiv::WouldOverflow );
pub fn into_inner(self) -> T
[src]
Returns the would-be-divided value.
Examples
use overflow_error::*; assert!(CannotDiv::ByZero.val(5).into_inner() == 5); assert!(CannotDiv::WouldOverflow.val(5).into_inner() == 5);
pub fn as_inner(&self) -> &T
[src]
References the would-be-divided value.
Examples
use overflow_error::*; assert!(*CannotDiv::ByZero.val(5).as_inner() == 5); assert!(*CannotDiv::WouldOverflow.val(5).as_inner() == 5);
pub fn map<U, F>(self, f: F) -> CannotDivValue<U> where
F: FnOnce(T) -> U,
[src]
F: FnOnce(T) -> U,
Applies a function to the would-be-divided value.
Examples
use overflow_error::*; assert!(*CannotDiv::ByZero.val(5).map(i32::wrapping_neg).as_inner() == -5); assert!(*CannotDiv::WouldOverflow.val(5).map(i32::wrapping_neg).as_inner() == -5);
Trait Implementations
impl<T: Copy> Copy for CannotDivValue<T>
[src]
impl<T: Clone> Clone for CannotDivValue<T>
[src]
fn clone(&self) -> CannotDivValue<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for CannotDivValue<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: PartialEq> PartialEq for CannotDivValue<T>
[src]
fn eq(&self, __arg_0: &CannotDivValue<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &CannotDivValue<T>) -> bool
[src]
This method tests for !=
.
impl<T: Eq> Eq for CannotDivValue<T>
[src]
impl<T: Hash> Hash for CannotDivValue<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> From<DivValueByZero<T>> for CannotDivValue<T>
[src]
fn from(err: DivValueByZero<T>) -> CannotDivValue<T>
[src]
Performs the conversion.
impl<T> From<WouldOverflowValue<T>> for CannotDivValue<T>
[src]
fn from(err: WouldOverflowValue<T>) -> CannotDivValue<T>
[src]
Performs the conversion.
impl<T: Display> Display for CannotDivValue<T>
[src]
Auto Trait Implementations
impl<T> Send for CannotDivValue<T> where
T: Send,
T: Send,
impl<T> Sync for CannotDivValue<T> where
T: Sync,
T: Sync,