lazy-exclusive
a global container type (like LazyLock
) with runtime-checked mutability. can be used for static
variables
let lazy = new;
let mut lock = lazy.get.unwrap; // Mut<'_, i32>
let mut mutref = &mut *lock; // &mut i32
println!; // will print 20
let opt = lazy.get; // is none because lock still exists
add this crate to your code like this:
use-locks
enable the use-locks
feature for the crate to use system-implemented locks.
static SHARED: = new;
let mut lock = SHARED.get.unwrap;
spawn;
assert_eq!;
let new_lock = SHARED.wait;
assert_eq!;