[−][src]Struct try_lock::TryLock
A light-weight lock guarded by an atomic boolean.
Most efficient when contention is low, acquiring the lock is a single atomic swap, and releasing it just 1 more atomic swap.
It is only possible to try to acquire the lock, it is not possible to
wait for the lock to become ready, like with a Mutex.
Methods
impl<T> TryLock<T>[src]
pub fn new(val: T) -> TryLock<T>[src]
Create a TryLock around the value.
pub fn try_lock(&self) -> Option<Locked<T>>[src]
Try to acquire the lock of this value.
If the lock is already acquired by someone else, this returns
None. You can try to acquire again whenever you want, perhaps
by spinning a few times, or by using some other means of
notification.
Trait Implementations
impl<T: Debug> Debug for TryLock<T>[src]
impl<T: Send> Send for TryLock<T>[src]
impl<T: Send> Sync for TryLock<T>[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for TryLock<T>
impl<T> Unpin for TryLock<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for TryLock<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,