You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-03 21:39:51 +02:00
Split interior mutability, mention OnceCell/OnceLock (#2573)
These types are really only useful as a static or in a user-defined type, neither of which are covered at this point.
This commit is contained in:
committed by
GitHub
parent
5f7e0c3f64
commit
8121e7de7c
@ -34,6 +34,9 @@ Interior mutability is possible through a
|
||||
[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html), atomic or
|
||||
similar.
|
||||
|
||||
It is common to use `OnceLock` in a static as a way to support initialization on
|
||||
first use. `OnceCell` is not `Sync` and thus cannot be used in this context.
|
||||
|
||||
Thread-local data can be created with the macro `std::thread_local`.
|
||||
|
||||
</details>
|
||||
|
Reference in New Issue
Block a user