Enum dashu_base::approx::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: Clone, E: Clone> Clone for Approximation<T, E>
impl<T: Clone, E: Clone> 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: PartialEq, E: PartialEq> PartialEq<Approximation<T, E>> for Approximation<T, E>
impl<T: PartialEq, E: PartialEq> PartialEq<Approximation<T, E>> 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: Copy, E: Copy> Copy for Approximation<T, E>
impl<T: Eq, E: Eq> Eq for Approximation<T, E>
impl<T, E> StructuralEq for Approximation<T, E>
impl<T, E> StructuralPartialEq for Approximation<T, E>
Auto Trait Implementations§
impl<T, E> RefUnwindSafe for Approximation<T, E>where E: RefUnwindSafe, T: RefUnwindSafe,
impl<T, E> Send for Approximation<T, E>where E: Send, T: Send,
impl<T, E> Sync for Approximation<T, E>where E: Sync, T: Sync,
impl<T, E> Unpin for Approximation<T, E>where E: Unpin, T: Unpin,
impl<T, E> UnwindSafe for Approximation<T, E>where E: UnwindSafe, 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