Struct no_std_compat2::sync::RwLockReadGuard
source · pub struct RwLockReadGuard<'a, T>where
T: 'a + ?Sized,{ /* private fields */ }Available on crate feature
alloc and crate feature compat_sync and non-crate feature std only.Expand description
A guard that provides immutable data access.
When the guard falls out of scope it will decrement the read count, potentially releasing the lock.
Implementations§
source§impl<'rwlock, T> RwLockReadGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> RwLockReadGuard<'rwlock, T>where T: ?Sized,
sourcepub fn leak(this: RwLockReadGuard<'rwlock, T>) -> &'rwlock T
pub fn leak(this: RwLockReadGuard<'rwlock, T>) -> &'rwlock T
Leak the lock guard, yielding a reference to the underlying data.
Note that this function will permanently lock the original lock for all but reading locks.
let mylock = spin::RwLock::new(0);
let data: &i32 = spin::RwLockReadGuard::leak(mylock.read());
assert_eq!(*data, 0);Trait Implementations§
source§impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T>where T: ?Sized,
source§impl<'rwlock, T> Drop for RwLockReadGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> Drop for RwLockReadGuard<'rwlock, T>where T: ?Sized,
source§impl<'a, T: ?Sized> UnwrapExt for RwLockReadGuard<'a, T>
Available on crate feature compat_guard_unwrap only.
impl<'a, T: ?Sized> UnwrapExt for RwLockReadGuard<'a, T>
Available on crate feature
compat_guard_unwrap only.impl<T> Send for RwLockReadGuard<'_, T>where T: Sync + ?Sized,
impl<T> Sync for RwLockReadGuard<'_, T>where T: Sync + ?Sized,
Auto Trait Implementations§
impl<'a, T: ?Sized> RefUnwindSafe for RwLockReadGuard<'a, T>where T: RefUnwindSafe,
impl<'a, T: ?Sized> Unpin for RwLockReadGuard<'a, T>
impl<'a, T: ?Sized> UnwindSafe for RwLockReadGuard<'a, T>where T: RefUnwindSafe,
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