Crate thunk [] [src]

This crate provides functionality for thread-safe and non-thread-safe lazy evaluation in Rust. It also provides functionality for generically working with thunks of a given type.

Three different owned thunk types are provided, implementing Lazy, LazyRef, and LazyMut: * Thunk: a non thread-safe thunk. * AtomicThunk: a thread-safe thunk, which implements Send + Sync. * Strict: a strict, non-deferred thunk which always immediately evaluates whatever computation it's given, intended for genericity over strictness.

In addition, two shared thunk types are provided, implementing LazyRef and LazyShared: * RcThunk: a reference-counted thunk type. This is a wrapper over Thunk. * ArcThunk: an atomically reference-counted thunk type. This is a wrapper over AtomicThunk.

Reexports

pub use strict::Strict;
pub use sync::AtomicThunk;
pub use sync::ArcThunk;
pub use unsync::Thunk;
pub use unsync::RcThunk;

Modules

strict
sync
unsync

Traits

Lazy

The Lazy trait abstracts owned, lazily computed values.

LazyMut

The LazyMut trait abstracts mutable references to lazily computed values.

LazyRef

The Lazy trait abstracts thunks which have exactly the same lifetimes as the types they defer computation of.