Mutex

    Notice how we have a blanket implementation.

    • Mutex in Rust looks like a collection with just one element - the protected data.
    • You can get an &mut T from an &Mutex<T> by taking the lock. The MutexGuard ensures that the &mut T doesn’t outlive the lock being held.
    • A read-write lock counterpart - RwLock.