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

#200 in Rust patterns

Download history 2461/week @ 2022-08-13 861/week @ 2022-08-20 658/week @ 2022-08-27 736/week @ 2022-09-03 838/week @ 2022-09-10 696/week @ 2022-09-17 826/week @ 2022-09-24 1226/week @ 2022-10-01 989/week @ 2022-10-08 907/week @ 2022-10-15 746/week @ 2022-10-22 976/week @ 2022-10-29 1293/week @ 2022-11-05 776/week @ 2022-11-12 906/week @ 2022-11-19 856/week @ 2022-11-26

4,046 downloads per month
Used in 14 crates (6 directly)

Apache-2.0/MIT

14KB
227 lines


lib.rs:

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