Struct maitake::sync::spin::RwLockReadGuard
source · pub struct RwLockReadGuard<'lock, T>where
T: ?Sized,{ /* private fields */ }
Expand description
An RAII implementation of a “scoped read lock” of a RwLock
. When this
structure is dropped (falls out of scope), the lock will be unlocked.
The data protected by the RwLock
can be immutably accessed through this
guard via its Deref
implementation.
This structure is created by the read
and try_read
methods on
RwLock
.
Trait Implementations§
source§impl<T, R> AsRef<R> for RwLockReadGuard<'_, T>
impl<T, R> AsRef<R> for RwLockReadGuard<'_, T>
source§impl<T> Debug for RwLockReadGuard<'_, T>
impl<T> Debug for RwLockReadGuard<'_, T>
source§impl<T> Deref for RwLockReadGuard<'_, T>where
T: ?Sized,
impl<T> Deref for RwLockReadGuard<'_, T>where
T: ?Sized,
source§impl<T> Display for RwLockReadGuard<'_, T>
impl<T> Display for RwLockReadGuard<'_, T>
source§impl<T> Drop for RwLockReadGuard<'_, T>where
T: ?Sized,
impl<T> Drop for RwLockReadGuard<'_, T>where
T: ?Sized,
impl<T> Send for RwLockReadGuard<'_, T>
A RwLockReadGuard
only allows immutable (&T
) access to a T
.
Therefore, it is Send
and Sync
as long as T
is Sync
, because
it can be used to share references to a T
across multiple threads
(requiring T: Sync
), but it cannot be used to move ownership of a T
across thread boundaries, as the T
cannot be taken out of the lock through
a RwLockReadGuard
.
impl<T> Sync for RwLockReadGuard<'_, T>
Auto Trait Implementations§
impl<'lock, T> Freeze for RwLockReadGuard<'lock, T>where
T: ?Sized,
impl<'lock, T> RefUnwindSafe for RwLockReadGuard<'lock, T>where
T: RefUnwindSafe + ?Sized,
impl<'lock, T> Unpin for RwLockReadGuard<'lock, T>where
T: ?Sized,
impl<'lock, T> UnwindSafe for RwLockReadGuard<'lock, T>where
T: RefUnwindSafe + ?Sized,
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