Struct maitake_sync::spin::RwLockReadGuard
source · pub struct RwLockReadGuard<'lock, 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: ?Sized> AsRef<R> for RwLockReadGuard<'_, T>
impl<T, R: ?Sized> AsRef<R> for RwLockReadGuard<'_, T>
source§impl<T: ?Sized> Deref for RwLockReadGuard<'_, T>
impl<T: ?Sized> Deref for RwLockReadGuard<'_, T>
source§impl<T: ?Sized> Drop for RwLockReadGuard<'_, T>
impl<T: ?Sized> Drop for RwLockReadGuard<'_, T>
impl<T: ?Sized + Sync> 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: ?Sized + Sync> 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