Struct futures_channel::lock::Lock
source · pub(crate) struct Lock<T> {
locked: AtomicBool,
data: UnsafeCell<T>,
}
Expand description
A “mutex” around a value, similar to std::sync::Mutex<T>
.
This lock only supports the try_lock
operation, however, and does not
implement poisoning.
Fields§
§locked: AtomicBool
§data: UnsafeCell<T>
Implementations§
source§impl<T> Lock<T>
impl<T> Lock<T>
sourcepub(crate) fn try_lock(&self) -> Option<TryLock<'_, T>>
pub(crate) fn try_lock(&self) -> Option<TryLock<'_, T>>
Attempts to acquire this lock, returning whether the lock was acquired or not.
If Some
is returned then the data this lock protects can be accessed
through the sentinel. This sentinel allows both mutable and immutable
access.
If None
is returned then the lock is already locked, either elsewhere
on this thread or on another thread.
Trait Implementations§
impl<T: Send> Send for Lock<T>
impl<T: Send> Sync for Lock<T>
Auto Trait Implementations§
impl<T> !Freeze for Lock<T>
impl<T> !RefUnwindSafe for Lock<T>
impl<T> Unpin for Lock<T>where
T: Unpin,
impl<T> UnwindSafe for Lock<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more