[−][src]Crate futures_locks
A library of Futures-aware locking primitives. These locks can safely
be used in asynchronous environments like Tokio. When they block,
they'll only block a single task, not the entire reactor.
These primitives generally work much like their counterparts from the
standard library. But instead of blocking, they return a Future that
completes when the lock has been acquired.
Examples
let mtx = Mutex::<u32>::new(0); let fut = mtx.lock().map(|mut guard| { *guard += 5; }); spawn(fut).wait_future(); assert_eq!(mtx.try_unwrap().unwrap(), 5);
Structs
| Mutex | A Futures-aware Mutex. |
| MutexFut | A |
| MutexGuard | An RAII mutex guard, much like |
| MutexWeak |
|
| RwLock | A Futures-aware RwLock. |
| RwLockReadFut | A |
| RwLockReadGuard | An RAII guard, much like |
| RwLockWriteFut | A |
| RwLockWriteGuard | An RAII guard, much like |