pub enum Quotient<T>{
Nan,
Number(T),
}Expand description
The result of a division
Variants§
Implementations§
Source§impl<T> Quotient<T>
impl<T> Quotient<T>
Sourcepub fn map<U, F>(self, f: F) -> Quotient<U>
pub fn map<U, F>(self, f: F) -> Quotient<U>
Map a Quotient<T> to Quotient<U> by applying a function to a
contained value.
Sourcepub const fn number_mut(&mut self) -> Option<&mut T>
pub const fn number_mut(&mut self) -> Option<&mut T>
Convert from &mut Quotient<T> to Option<&mut T>.
Sourcepub fn ok_or<E>(self, err: E) -> Result<T, E>
pub fn ok_or<E>(self, err: E) -> Result<T, E>
Transform the Quotient<T> into a Result<T, E>, mapping Number(v)
to Ok(v) and Nan to Err(err).
Sourcepub fn ok_or_else<E, F>(self, f: F) -> Result<T, E>where
F: FnOnce() -> E,
pub fn ok_or_else<E, F>(self, f: F) -> Result<T, E>where
F: FnOnce() -> E,
Transform the Quotient<T> into a Result<T, E>, mapping Number(v)
to Ok(v) and Nan to Err(err).
Sourcepub fn or_else<F>(self, f: F) -> Selfwhere
F: FnOnce() -> Self,
pub fn or_else<F>(self, f: F) -> Selfwhere
F: FnOnce() -> Self,
Return the number if not Nan, otherwise call f and
return the result.
Trait Implementations§
Source§impl<T> Ord for Quotient<T>
impl<T> Ord for Quotient<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialOrd for Quotient<T>
impl<T> PartialOrd for Quotient<T>
impl<T> Copy for Quotient<T>
impl<T> Eq for Quotient<T>
impl<T> StructuralPartialEq for Quotient<T>
Auto Trait Implementations§
impl<T> Freeze for Quotient<T>where
T: Freeze,
impl<T> RefUnwindSafe for Quotient<T>where
T: RefUnwindSafe,
impl<T> Send for Quotient<T>where
T: Send,
impl<T> Sync for Quotient<T>where
T: Sync,
impl<T> Unpin for Quotient<T>where
T: Unpin,
impl<T> UnwindSafe for Quotient<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