Struct thunk::sync::ArcThunk
[−]
[src]
pub struct ArcThunk<T>(_);
An Arc
-wrapped AtomicThunk
which implements LazyRef
.
Methods
impl<T> ArcThunk<T>
[src]
fn try_unwrap(this: ArcThunk<T>) -> Result<T, ArcThunk<T>>
If the ArcThunk
is unevaluated, this will force it. If the RcThunk
is
the sole, unique owner of the underlying thunk, this will return the forced
value; otherwise, it will return an Err
containing the original ArcThunk
.
fn get_mut(this: &mut ArcThunk<T>) -> Option<&mut T>
If the ArcThunk
is unevaluated, this will force it. If the RcThunk
is
the sole, unique owner of the underlying thunk, this will return a
mutable reference to the forced value; otherwise, it will return None
.
fn make_mut(this: &mut ArcThunk<T>) -> &mut T where
T: Clone,
T: Clone,
If the ArcThunk
is unevaluated, this will force it. If the RcThunk
is the sole, unique owner of the underlying thunk, this will return a
mutable reference to the forced value; if it is not, then it will clone
the forced value and return a mutable reference to the newly cloned
value. The &mut ArcThunk
passed in will be updated to reference the
newly cloned value.
Trait Implementations
impl<T> Clone for ArcThunk<T>
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T> AsRef<T> for ArcThunk<T>
[src]
fn as_ref(&self) -> &T
Performs the conversion.
impl<T> Deref for ArcThunk<T>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<T> From<T> for ArcThunk<T>
[src]
impl<T> LazyRef for ArcThunk<T>
[src]
fn defer<'a, F: FnOnce() -> T + 'a>(f: F) -> ArcThunk<T>
Defer a computation stored as a FnOnce
closure. Unwrapping/dereferencing will force the computation of the closure. The supplied closure must live as long as the type which the thunk computes. Read more
fn force(&self)
Manually force a thunk's computation.
fn computed(t: Self::Target) -> Self
Construct a thunk with a precomputed value. This means forcing the thunk is a no-op. Read more