A mutex protecting some data.
struct Mutex<T> {
/* private fields */
}| Name | Description |
|---|---|
| new | Creates a new mutex. |
| Receiver | Name | Description |
|---|---|---|
&self | as_lock | Returns the underlying lock of this mutex. |
&mut self | data | Provides mutable access to the protected data without locking the lock. |
&self | existing_lock | Turns a lock-guard of the underlying lock into a mutex-guard. |
&self | lock | Locks the mutex by sleeping until the mutex is unlocked if it's currently locked. |
&self | try_lock | Tries to lock the mutex if it's currently unlocked. |
| Name | Description |
|---|---|
| Send | Objects whose ownership can be moved from one thread to another. |
| Sync | Objects that allow immutable access from threads other than their owning thread. |