Tracking Issue for `OnceCell::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_cell_new_init)]
This is a tracking issue for OnceCell::new_init, as discussed in the ACP: https://github.com/rust-lang/libs-team/issues/817
Sister Tracking issue for OnceLock::new_init: https://github.com/rust-lang/rust/issues/159860
Currently, it is impossible to create an already initialized version of OnceCell:
- Without using the
From<T>implementation forOnceCell<T> - In a const context
This new method aims to solve both of these issues.
Public API
impl<T> OnceCell<T> {
pub const fn new_init(init_value: T) -> OnceCell<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 with the ACP in rust-lang/libs-team#817 and the implementation referenced as #160881, then read the feature-lifecycle stabilization guide linked in the issue. The remaining work is tracking the final comment period, stabilization PR, and unresolved API naming question; completion is indicated by those checklist items being resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100