Feature gate: #![feature(lock_value_accessors)]
This is a tracking issue for feature lock_value_accessors.
Public API
impl<T> Mutex<T> {
pub fn get_cloned(&self) -> Result<T, PoisonError<()>> where T: Clone { ... }
pub fn set(&self, value: T) -> Result<(), PoisonError<T>> { ... }
pub fn replace(&self, value: T) -> LockResult<T> { ... }
}
impl<T> RwLock<T> {
pub fn get_cloned(&self) -> Result<T, PoisonError<()>> where T: Clone { ... }
pub fn set(&self, value: T) -> Result<(), PoisonError<T>> { ... }
pub fn replace(&self, value: T) -> LockResult<T> { ... }
}
impl<T> nonpoison::Mutex<T>
where
T: ?Sized
{
pub fn get_cloned(&self) -> T where T: Clone { ... }
pub fn set(&self, value: T) { ... }
pub fn replace(&self, value: T) -> T { ... }
pub fn with_mut<F, R>(&self, f: F) -> R where F: FnOnce(&mut T) -> R { ... }
}
impl<T> nonpoison::RwLock<T>
where
T: ?Sized
{
pub fn get_cloned(&self) -> T where T: Clone { ... }
pub fn set(&self, value: T) { ... }
pub fn replace(&self, value: T) -> T { ... }
pub fn with<F, R>(&self, f: F) -> R where F: FnOnce(&T) -> R { ... }
pub fn with_mut<F, R>(&self, f: F) -> R where F: FnOnce(&mut T) -> R { ... }
}
Steps / History
Unresolved Questions
- Whether we should checking poisoning first and avoid unnecessary lock acquire attempts.
Links
Feature gate:
#![feature(lock_value_accessors)]This is a tracking issue for feature
lock_value_accessors.Public API
Steps / History
get,setandreplacemethods toMutexandRwLocklibs-team#485MutexandRwLock#133406Mutex::with_mut,RwLock::withandRwLock::with_mut#147328Unresolved Questions
Links
MutexandRwLockAPIs for accessing values within a function scope libs-team#497Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩