Struct ReentrantLockGuard

#[must_use = "if unused the ReentrantLock will immediately unlock"]
pub struct ReentrantLockGuard<'a, T: ?Sized + 'a> { pub(in ::sync::reentrant_lock) lock: &'a ReentrantLock<T> }

An RAII implementation of a "scoped lock" of a re-entrant lock. When this structure is dropped (falls out of scope), the lock will be unlocked.

The data protected by the mutex can be accessed through this guard via its Deref implementation.

This structure is created by the lock method on ReentrantLock.

Mutability

Unlike MutexGuard, ReentrantLockGuard does not implement DerefMut, because implementation of the trait would violate Rust’s reference aliasing rules. Use interior mutability (usually RefCell) in order to mutate the guarded data.

Fields

lock: &'a ReentrantLock<T>

Trait Implementations

impl<T: ?Sized + Sync> Sync for ReentrantLockGuard<'_, T>

impl<T: ?Sized> !Send for ReentrantLockGuard<'_, T>

impl<T: ?Sized> Deref for ReentrantLockGuard<'_, T>

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

impl<T: ?Sized> Drop for ReentrantLockGuard<'_, T>

fn drop(&mut self)

impl<T: Debug + ?Sized> Debug for ReentrantLockGuard<'_, T>

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

impl<T: Display + ?Sized> Display for ReentrantLockGuard<'_, T>

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

Auto Trait Implementations

impl<'a, T> Freeze for ReentrantLockGuard<'a, T> where &'a ReentrantLock<T>: Freeze, T: ?Sized,

impl<'a, T> RefUnwindSafe for ReentrantLockGuard<'a, T> where &'a ReentrantLock<T>: RefUnwindSafe, T: ?Sized,

impl<'a, T> Unpin for ReentrantLockGuard<'a, T> where &'a ReentrantLock<T>: Unpin, T: ?Sized,

impl<'a, T> UnsafeUnpin for ReentrantLockGuard<'a, T> where &'a ReentrantLock<T>: UnsafeUnpin, T: ?Sized,

impl<'a, T> UnwindSafe for ReentrantLockGuard<'a, T> where &'a ReentrantLock<T>: UnwindSafe, T: ?Sized,

Blanket Implementations

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

type Target = T;

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for ReentrantLockGuard<'a, T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for ReentrantLockGuard<'a, T>

impl<T> ToString for ReentrantLockGuard<'a, T> where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for ReentrantLockGuard<'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 ReentrantLockGuard<'a, T> where U: Into<T>,

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

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

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