MutexGuardArc in async_std::sync - Rust (original) (raw)
Struct MutexGuardArc
pub struct MutexGuardArc<T>(/* private fields */)
where
T: ?Sized;
Expand description
An owned guard that releases the mutex when dropped.
Implementations§
impl MutexGuardArc
pub fn source(guard: &MutexGuardArc) -> &Arc<Mutex>
Returns a reference to the mutex a guard came from.
§Examples
use async_lock::{Mutex, MutexGuardArc};
use std::sync::Arc;
let mutex = Arc::new(Mutex::new(10i32));
let guard = mutex.lock_arc().await;
dbg!(MutexGuardArc::source(&guard));