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

#898 in Rust patterns

Download history 664/week @ 2024-01-03 689/week @ 2024-01-10 1189/week @ 2024-01-17 957/week @ 2024-01-24 875/week @ 2024-01-31 1042/week @ 2024-02-07 1141/week @ 2024-02-14 904/week @ 2024-02-21 758/week @ 2024-02-28 1184/week @ 2024-03-06 1133/week @ 2024-03-13 1125/week @ 2024-03-20 747/week @ 2024-03-27 863/week @ 2024-04-03 999/week @ 2024-04-10 898/week @ 2024-04-17

3,622 downloads per month
Used in 17 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