Tracking Issue for `OnceLock::new_init`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(once_lock_new_init)]
This is a tracking issue for OnceLock::new_init, as discussed in the ACP: https://github.com/rust-lang/libs-team/issues/817
Sister Tracking issue for OnceCell::new_init: https://github.com/rust-lang/rust/issues/159859
Currently, it is impossible to create an already initialized version of OnceLock:
- Without using the
From<T>implementation forOnceLock<T> - In a const context
This new method aims to solve both of these issues.
Public API
impl<T> OnceLock<T> {
pub const fn new_init(init_value: T) -> OnceLockl<T>;
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- ACP: rust-lang/libs-team#817
- Implementation: #160881
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Should the API name be
new_init, or something else? Some alternatives:new_initialized,with_value, ...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the implementation referenced as #160881 and the ACP at rust-lang/libs-team#817, then review the unresolved API naming question. The tracking work is done when the final comment period completes and a stabilization PR is opened.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100