Feature gate: #![feature(option_get_or_try_insert_with)]
This is a tracking issue for the Option::get_or_try_insert_with method
This method offers a convenient way of caching fallible operations, similar to OnceLock::get_or_try_init.
Public API
// core::option
impl Option {
use std::ops::{Residual, Try};
pub fn try_get_or_insert_with<'a, R, F>(
&'a mut self,
f: F,
) -> <R::Residual as Residual<&'a mut T>>::TryType
where
F: FnOnce() -> R,
R: Try<Output = T, Residual: Residual<&'a mut T>>;
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
Feature gate:
#![feature(option_get_or_try_insert_with)]This is a tracking issue for the
Option::get_or_try_insert_withmethodThis method offers a convenient way of caching fallible operations, similar to
OnceLock::get_or_try_init.Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩