rust-lang / rust-lang/rust

Tracking Issue for `lock_value_accessors`

Open
#133,407 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the public API and the completed implementation links, #133406 and #147328, then read ACPs 485 and 497 and the stabilization guide. The remaining work is the final comment period and stabilization PR; resolve the open poisoning question before considering the feature ready.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.