Tracking Issue for lock_value_accessors (original) (raw)
Feature gate: #![feature(lock_value_accessors)]
This is a tracking issue for feature lock_value_accessors.
Public API
impl Mutex { pub fn get_cloned(&self) -> Result<T, PoisonError<()>> where T: Clone { ... } pub fn set(&self, value: T) -> Result<(), PoisonError> { ... } pub fn replace(&self, value: T) -> LockResult { ... } }
impl RwLock { pub fn get_cloned(&self) -> Result<T, PoisonError<()>> where T: Clone { ... } pub fn set(&self, value: T) -> Result<(), PoisonError> { ... } pub fn replace(&self, value: T) -> LockResult { ... } }
impl nonpoison::Mutex 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 nonpoison::RwLock 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
- ACP: Add get, set and replace methods to Mutex and RwLock libs-team#485
- Implementation: Add value accessor methods to Mutex and RwLock #133406
- Implementation: Implement non-poisoning Mutex::with_mut, RwLock::with and RwLock::with_mut #147328
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Whether we should checking poisoning first and avoid unnecessary lock acquire attempts.