Feature Request: `OnceCell::with_value`
Cyborus04 opened this issue · comments
Cyborus04 commented
Creates a OnceCell
that is already initialized with the provided value, like
let x = OnceCell::new();
let _ = x.set(/* stuff */);
I have a use case where there's two paths to creating the OnceCell
, one where the contents are already known, and one where they're calculated later
I could probably implement this, if that's cool
Alex Kladov commented
This is already available as a From impl: https://docs.rs/once_cell/1.8.0/src/once_cell/lib.rs.html#800-806
Might be useful to mention it explicitly somewhere in the docs!