7 releases (4 breaking)

Uses old Rust 2015

0.5.1 Aug 1, 2022
0.5.0 Jan 18, 2021
0.4.0 Aug 22, 2020
0.3.0 Jan 18, 2018
0.1.1 Jan 28, 2017

#970 in Rust patterns

Download history 1588/week @ 2024-08-02 2407/week @ 2024-08-09 2589/week @ 2024-08-16 4380/week @ 2024-08-23 2810/week @ 2024-08-30 2815/week @ 2024-09-06 3615/week @ 2024-09-13 4699/week @ 2024-09-20 5234/week @ 2024-09-27 7071/week @ 2024-10-04 5925/week @ 2024-10-11 5076/week @ 2024-10-18 5071/week @ 2024-10-25 4842/week @ 2024-11-01 5007/week @ 2024-11-08 4714/week @ 2024-11-15

20,827 downloads per month
Used in 18 crates (8 directly)

Apache-2.0/MIT

14KB
227 lines

A crate for things that are

  1. Lazily initialized
  2. Expensive to create
  3. Immutable after creation
  4. Used on multiple threads

Lazy<T> is better than Mutex<Option<T>> 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).

No runtime deps