Enum dashu::base::Approximation
source · pub enum Approximation<T, E> {
Exact(T),
Inexact(T, E),
}Expand description
Represent an calculation result with a possible error.
Variants§
Exact(T)
The result is exact, contains the result value
Inexact(T, E)
The result is inexact, contains the result value and error
Implementations§
source§impl<T, E> Approximation<T, E>
impl<T, E> Approximation<T, E>
pub fn unwrap(self) -> T
pub fn error(self) -> Option<E>
pub const fn error_ref(&self) -> Option<&E>
pub fn map<U, F>(self, f: F) -> Approximation<U, E>where
F: FnOnce(T) -> U,
pub fn and_then<U, F>(self, f: F) -> Approximation<U, E>where
F: FnOnce(T) -> Approximation<U, E>,
Trait Implementations§
source§impl<T, E> Clone for Approximation<T, E>
impl<T, E> Clone for Approximation<T, E>
source§fn clone(&self) -> Approximation<T, E>
fn clone(&self) -> Approximation<T, E>
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, E> Debug for Approximation<T, E>
impl<T, E> Debug for Approximation<T, E>
source§impl<T, E> PartialEq for Approximation<T, E>
impl<T, E> PartialEq for Approximation<T, E>
source§fn eq(&self, other: &Approximation<T, E>) -> bool
fn eq(&self, other: &Approximation<T, E>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<T, E> Copy for Approximation<T, E>
impl<T, E> Eq for Approximation<T, E>
impl<T, E> StructuralPartialEq for Approximation<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for Approximation<T, E>
impl<T, E> RefUnwindSafe for Approximation<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for Approximation<T, E>
impl<T, E> Sync for Approximation<T, E>
impl<T, E> Unpin for Approximation<T, E>
impl<T, E> UnwindSafe for Approximation<T, E>where
T: UnwindSafe,
E: 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