Struct Locked

#[must_use = "TryLock will immediately unlock if not used"]
pub struct Locked<'a, T: 'a> { /* private fields */ }

A locked value acquired from a TryLock.

The type represents an exclusive view at the underlying value. The lock is released when this type is dropped.

This type derefs to the underlying value.

Trait Implementations

impl<'a, T> Deref for Locked<'a, T>

type Target = T;
fn deref(&self) -> &T

impl<'a, T> DerefMut for Locked<'a, T>

fn deref_mut(&mut self) -> &mut T

impl<'a, T> Drop for Locked<'a, T>

fn drop(&mut self)

impl<'a, T: Debug> Debug for Locked<'a, T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for Locked<'a, T>

impl<'a, T> !Send for Locked<'a, T>

impl<'a, T> !Sync for Locked<'a, T>

impl<'a, T> !UnwindSafe for Locked<'a, T>

impl<'a, T> Freeze for Locked<'a, T> where &'a TryLock<T>: Freeze, PhantomData<*mut T>: Freeze,

impl<'a, T> Unpin for Locked<'a, T> where &'a TryLock<T>: Unpin, PhantomData<*mut T>: Unpin,

impl<'a, T> UnsafeUnpin for Locked<'a, T> where &'a TryLock<T>: UnsafeUnpin, PhantomData<*mut T>: UnsafeUnpin,

Blanket Implementations

impl<P, T> Receiver for Locked<'a, T> where P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T;

impl<T> Any for Locked<'a, T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Locked<'a, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Locked<'a, T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Locked<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Locked<'a, T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Locked<'a, T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Locked<'a, T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>