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

#73 in Science

Download history 811/week @ 2022-06-12 692/week @ 2022-06-19 758/week @ 2022-06-26 862/week @ 2022-07-03 1171/week @ 2022-07-10 864/week @ 2022-07-17 1050/week @ 2022-07-24 1137/week @ 2022-07-31 1151/week @ 2022-08-07 2461/week @ 2022-08-14 836/week @ 2022-08-21 650/week @ 2022-08-28 786/week @ 2022-09-04 770/week @ 2022-09-11 714/week @ 2022-09-18 774/week @ 2022-09-25

3,103 downloads per month
Used in 16 crates (7 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