pub struct RwLockUpgradableReadGuard<'a, T: ?Sized> { /* private fields */ }Expand description
The upgradable read of a RwLock: shared access that can become
exclusive without a writer getting in between. Releases on drop, with
the progress RwLockReadGuard’s release makes.
It moves to another thread only when T is Send as well as Sync:
an upgrade turns it into &mut T, so moving it can move the value. A
value that may be shared but not moved, such as a
std::sync::MutexGuard, keeps the guard on its thread:
ⓘ
use nuclei::sync::RwLockUpgradableReadGuard;
use std::sync::MutexGuard;
fn moves<T: Send>() {}
moves::<RwLockUpgradableReadGuard<'static, Option<MutexGuard<'static, ()>>>>();Implementations§
Source§impl<'a, T: ?Sized> RwLockUpgradableReadGuard<'a, T>
impl<'a, T: ?Sized> RwLockUpgradableReadGuard<'a, T>
Sourcepub fn upgrade(self) -> Upgrade<'a, T> ⓘ
pub fn upgrade(self) -> Upgrade<'a, T> ⓘ
Waits for the readers inside to leave, holding new readers back meanwhile, then holds the write.
Sourcepub fn try_upgrade(self) -> Result<RwLockWriteGuard<'a, T>, Self>
pub fn try_upgrade(self) -> Result<RwLockWriteGuard<'a, T>, Self>
Holds the write at once if no reader is inside; otherwise hands the upgradable read back.
Trait Implementations§
Source§impl<T: ?Sized> Deref for RwLockUpgradableReadGuard<'_, T>
impl<T: ?Sized> Deref for RwLockUpgradableReadGuard<'_, T>
Source§impl<T: ?Sized> Drop for RwLockUpgradableReadGuard<'_, T>
impl<T: ?Sized> Drop for RwLockUpgradableReadGuard<'_, T>
impl<T: ?Sized + Send + Sync> Send for RwLockUpgradableReadGuard<'_, T>
impl<T: ?Sized + Sync> Sync for RwLockUpgradableReadGuard<'_, T>
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for RwLockUpgradableReadGuard<'a, T>
impl<'a, T> !UnwindSafe for RwLockUpgradableReadGuard<'a, T>
impl<'a, T> Freeze for RwLockUpgradableReadGuard<'a, T>where
T: ?Sized,
impl<'a, T> Unpin for RwLockUpgradableReadGuard<'a, T>where
T: ?Sized,
impl<'a, T> UnsafeUnpin for RwLockUpgradableReadGuard<'a, T>where
T: ?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