6 releases (breaking)

Uses old Rust 2015

0.5.0 Jan 18, 2021
0.4.0 Aug 22, 2020
0.3.0 Jan 18, 2018
0.2.0 Nov 11, 2017
0.1.1 Jan 28, 2017

#166 in Science

Download history 649/week @ 2020-12-19 397/week @ 2020-12-26 526/week @ 2021-01-02 465/week @ 2021-01-09 453/week @ 2021-01-16 433/week @ 2021-01-23 480/week @ 2021-01-30 439/week @ 2021-02-06 420/week @ 2021-02-13 455/week @ 2021-02-20 444/week @ 2021-02-27 432/week @ 2021-03-06 433/week @ 2021-03-13 473/week @ 2021-03-20 524/week @ 2021-03-27 670/week @ 2021-04-03

2,515 downloads per month
Used in 7 crates (4 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