Struct thunk::sync::AtomicThunk
[−]
[src]
pub struct AtomicThunk<T> { /* fields omitted */ }
A thread-safe AtomicThunk
, representing a lazily computed value.
TODO: Test Option<UnsafeCell<Cache<T>>>
instead of storing thunk
invalidation in the atomic flag
.
Trait Implementations
impl<T: Send> Send for AtomicThunk<T>
[src]
impl<T: Sync> Sync for AtomicThunk<T>
[src]
impl<T> Drop for AtomicThunk<T>
[src]
impl<T> AsRef<T> for AtomicThunk<T>
[src]
fn as_ref(&self) -> &T
Performs the conversion.
impl<T> AsMut<T> for AtomicThunk<T>
[src]
fn as_mut(&mut self) -> &mut T
Performs the conversion.
impl<T> Deref for AtomicThunk<T>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<T> DerefMut for AtomicThunk<T>
[src]
fn deref_mut(&mut self) -> &mut T
The method called to mutably dereference a value
impl<T> From<T> for AtomicThunk<T>
[src]
fn from(t: T) -> AtomicThunk<T>
Performs the conversion.
impl<T> Lazy for AtomicThunk<T>
[src]
fn defer<F: FnBox() -> T + 'static>(f: F) -> AtomicThunk<T>
Defer a computation stored as a FnOnce
closure. Unwrapping/dereferencing will force the computation of the closure. Read more
fn force(&self)
Manually force a thunk's computation.
fn unwrap(self) -> T
Unwrap a thunk into its inner value. This forces the thunk.
fn computed(t: Self::Target) -> Self
Construct a thunk with a precomputed value. This means unwrapping/dereferencing is effectively a no-op. Read more