Should there be a Once::try_call_once
#75952
Labels
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
I wonder if
Once
should have atry_call_once
method for failable initialization, which accepts aFnOnce() -> Result<(), E>
.OnceCell
has aget_or_try_init
method which can fail, so I think it would make sense forOnce
to have a failable initialisation method as well. Note that due to lack of failable init inOnce
right now,OnceCell
currently need to rely onpub(crate)
method to posion theOnce
forget_or_try_init
.cc #33577
@rustbot modify labels: +T-libs
The text was updated successfully, but these errors were encountered: