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

#908 in Rust patterns

Download history 711/week @ 2024-01-07 870/week @ 2024-01-14 1176/week @ 2024-01-21 949/week @ 2024-01-28 767/week @ 2024-02-04 1293/week @ 2024-02-11 922/week @ 2024-02-18 808/week @ 2024-02-25 1109/week @ 2024-03-03 1122/week @ 2024-03-10 1168/week @ 2024-03-17 769/week @ 2024-03-24 895/week @ 2024-03-31 869/week @ 2024-04-07 1143/week @ 2024-04-14 1205/week @ 2024-04-21

4,155 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