Feature gate: #![feature(lazy_get)]
This is a tracking issue for LazyCell/Lock::get[_mut](), allowing you to extract a reference from a Lazy only if it is initialized, approved in ACP rust-lang/libs-team#429.
Public API
impl<T, F> core::cell::LazyCell<T, F> {
pub fn get(this: &Self) -> Option<&T>;
pub fn get_mut(this: &mut Self) -> Option<&mut T>;
pub fn force_mut(this: &mut Self) -> &mut T;
}
impl<T, F> std::sync::LazyLock<T, F> {
pub fn get(this: &Self) -> Option<&T>;
pub fn get_mut(this: &mut Self) -> Option<&mut T>;
pub fn force_mut(this: &mut Self) -> &mut T;
}
Steps / History
Unresolved Questions
Feature gate:
#![feature(lazy_get)]This is a tracking issue for
LazyCell/Lock::get[_mut](), allowing you to extract a reference from aLazyonly if it is initialized, approved in ACP rust-lang/libs-team#429.Public API
Steps / History
LazyLock/Cellget_mut()andDerefMutlibs-team#429DerefMuttoLazy[Cell/Lock]#129334Lazy{Cell,Lock}::get[_mut]andforce_mut#130476Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩