pub struct ComputableResult<T, C: Computable<T>> { /* private fields */ }Expand description
A result-like object that stores the result of a Computable for later use.
Implementations§
Source§impl<T, C: Computable<T>> ComputableResult<T, C>
impl<T, C: Computable<T>> ComputableResult<T, C>
Sourcepub fn new(computable: C) -> Self
pub fn new(computable: C) -> Self
Create a new ComputableResult from an instance of Computable.
Sourcepub fn try_compute(&mut self) -> Completable<&T>
pub fn try_compute(&mut self) -> Completable<&T>
Advance the inner Computable and return its result or return a reference
to the already computed result.
Sourcepub fn result_ref(&self) -> Option<&T>
pub fn result_ref(&self) -> Option<&T>
A reference to the computed result, assuming it is already available.
Sourcepub fn computable_ref(&self) -> &C
pub fn computable_ref(&self) -> &C
A reference to the underlying computation, assuming it is still available.
Sourcepub fn computable(self) -> C
pub fn computable(self) -> C
The underlying computation, assuming it is still available.
Trait Implementations§
Source§impl<T: Clone, C: Clone + Computable<T>> Clone for ComputableResult<T, C>
impl<T: Clone, C: Clone + Computable<T>> Clone for ComputableResult<T, C>
Source§fn clone(&self) -> ComputableResult<T, C>
fn clone(&self) -> ComputableResult<T, C>
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 moreSource§impl<T: Debug, C: Debug + Computable<T>> Debug for ComputableResult<T, C>
impl<T: Debug, C: Debug + Computable<T>> Debug for ComputableResult<T, C>
Source§impl<T, C: Computable<T>> From<C> for ComputableResult<T, C>
impl<T, C: Computable<T>> From<C> for ComputableResult<T, C>
Source§impl<T: PartialEq, C: PartialEq + Computable<T>> PartialEq for ComputableResult<T, C>
impl<T: PartialEq, C: PartialEq + Computable<T>> PartialEq for ComputableResult<T, C>
impl<T: Eq, C: Eq + Computable<T>> Eq for ComputableResult<T, C>
impl<T, C: Computable<T>> StructuralPartialEq for ComputableResult<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for ComputableResult<T, C>
impl<T, C> RefUnwindSafe for ComputableResult<T, C>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for ComputableResult<T, C>
impl<T, C> Sync for ComputableResult<T, C>
impl<T, C> Unpin for ComputableResult<T, C>
impl<T, C> UnwindSafe for ComputableResult<T, C>where
C: 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