Crate lazy_init [] [src]

A crate for things that are 1) Lazily initialized 2) Expensive to create 3) Immutable after creation 4) Used on multiple threads

Lazy is better than Mutex> because after creation accessing T does not require any locking, just a single boolean load with Ordering::Acquire (which on x86 is just a compiler barrier, not an actual memory barrier).

Structs

Lazy

Lazy<T> is a lazily initialized synchronized holder type. You can think of it as a LazyTransform where the initial type doesn't exist.

LazyTransform

LazyTransform<T, U> is a synchronized holder type, that holds a value of type T until it is lazily converted into a value of type U.