The type of the protected value.
Readonly[toThe well-known symbol Symbol.toStringTag used by Object.prototype.toString().
Acquires a read lock and returns a copy of the protected value.
A promise that resolves to a copy of the value.
Acquires a read lock and returns a guard for manual control.
A promise that resolves to a read guard.
Acquires a write lock and sets a new value.
The new value to set.
A promise that resolves when the value has been set.
Attempts to acquire a read lock without waiting.
Returns None if a write lock is currently held.
Some(guard) if acquired, None if a writer holds the lock.
Attempts to acquire a write lock without waiting.
Returns None if any read or write lock is currently held.
Some(guard) if acquired, None if any lock is held.
Acquires a read lock and executes the callback with the protected value.
Multiple read operations can execute concurrently.
The return type of the callback.
A promise that resolves to the callback's return value.
Acquires a write lock and executes the callback with the protected value.
Write operations are exclusive - no other reads or writes can proceed.
The return type of the callback.
A promise that resolves to the callback's return value.
Acquires a write lock and returns a guard for manual control.
A promise that resolves to a write guard.
An async read-write lock for protecting shared data.
This lock allows multiple concurrent readers or a single exclusive writer. Writers are given priority to prevent writer starvation.
Since
1.8.0
See
https://doc.rust-lang.org/std/sync/struct.RwLock.html
Example