mutex-timeouts
an incredibly simple crate that allows you to create mutexes with timeouts.
should be a nearly drop-in replacement for std::sync::Mutex, or tokio::sync::Mutex;
however, you will need to specify a timeout duration when creating the mutex.
use MutexWithTimeout as Mutex;
use Duration;
let mutex = new;
// this will block for at most 1 second, and then return an error if the mutex is still locked
let _ = mutex.lock.unwrap;
// this will block for at most one second, but not return an error if the mutex is still locked
if let Some = mutex.try_lock.unwrap