-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
This supercedes #74465 after a portion of once_cell was stabilized with #105587
Feature gate: #![feature(once_cell_try)]
This is a tracking issue for the *try* methods that go with the once_cell feature. Initially they were part of stabilization under once_cell (#105587) but was removed due to compatibility concerns with try trait v2 (#105587 (comment)).
Public API
impl<T> OnceCell<T> {
pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>;
}
impl<T> OnceLock<T> {
pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>;
}Steps / History
- Original implementation: Add lazy initialization primitives to std #72414
- Try trait changes: Use
Trytrait to makeOnce[Cell | Lock]::get_or_try_initgeneric over return type #107122 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.
cc @joboet @matklad just for reference
Footnotes
joboet, MatrixDev, zopsicle, rich-g, MaxVerevkin and 35 moremarmitar, cimandef, dcormier and marc0x71alex
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.