blob: 1c6faff70bbad8f623a17487258c582f6c0c6a61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
pub type Mutex<T> = async_std::sync::Arc<async_std::sync::Mutex<T>>;
pub type Guard<T> = async_std::sync::MutexGuardArc<T>;
pub fn new<T>(t: T) -> async_std::sync::Arc<async_std::sync::Mutex<T>> {
async_std::sync::Arc::new(async_std::sync::Mutex::new(t))
}
pub fn clone<T>(m: &Mutex<T>) -> Mutex<T> {
async_std::sync::Arc::clone(m)
}
pub fn unwrap<T: std::fmt::Debug>(t: Mutex<T>) -> Option<T> {
if let Ok(mutex) = async_std::sync::Arc::try_unwrap(t) {
Some(async_std::sync::Mutex::into_inner(mutex))
} else {
None
}
}
|