pub struct Mutex<T> { /* private fields */ }
Expand description
Mock implementation of std::sync::Mutex
.
Implementations
sourceimpl<T> Mutex<T>
impl<T> Mutex<T>
sourcepub fn lock(&self) -> LockResult<MutexGuard<'_, T>>
pub fn lock(&self) -> LockResult<MutexGuard<'_, T>>
Acquires a mutex, blocking the current thread until it is able to do so.
sourcepub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, T>>
pub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, T>>
Attempts to acquire this lock.
If the lock could not be acquired at this time, then Err
is returned.
Otherwise, an RAII guard is returned. The lock will be unlocked when the
guard is dropped.
This function does not block.
sourcepub fn into_inner(self) -> LockResult<T>
pub fn into_inner(self) -> LockResult<T>
Consumes this mutex, returning the underlying data.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Mutex<T>
impl<T> Send for Mutex<T> where
T: Send,
impl<T> Sync for Mutex<T> where
T: Send,
impl<T> Unpin for Mutex<T> where
T: Unpin,
impl<T> UnwindSafe for Mutex<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more