Skip to content

Commit af0c4f2

Browse files
Mention once_cell/lazy_static
1 parent fe2fb2b commit af0c4f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

posts/2024-07-25-Rust-1.80.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ If you'd like to help us out by testing future releases, you might consider upda
2121

2222
### `LazyCell` and `LazyLock`
2323

24-
These "lazy" types delay the initialization of their data until first access. They are similar to the `OnceCell` and `OnceLock` types [stabilized in 1.70](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#oncecell-and-oncelock), but with the initialization function included in the cell.
24+
These "lazy" types delay the initialization of their data until first access. They are similar to the `OnceCell` and `OnceLock` types [stabilized in 1.70](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#oncecell-and-oncelock), but with the initialization function included in the cell. This completes the stabilization of functionality adopted into the standard library from the popular [`lazy_static`](https://crates.io/crates/lazy-static) and [`once_cell`](https://crates.io/crates/once_cell) crates.
2525

2626
`LazyLock` is the thread-safe option, making it suitable for places like `static` values. For example, both the `spawn` thread and the main `scope` will see the exact same duration below, since `LAZY_TIME` will be initialized once, by whichever ends up accessing the static first. Neither use has to know *how* to initialize it, unlike they would with `OnceLock::get_or_init()`.
2727

0 commit comments

Comments
 (0)