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 duplicate 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 moreimpl<T: Copy, E: Copy> Copy for Approximation<T, E>
impl<T: Eq, E: Eq> 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