Struct once_cell::sync::OnceCell [−][src]
pub struct OnceCell<T> { /* fields omitted */ }
Methods
impl<T> OnceCell<T>
[src]
impl<T> OnceCell<T>
pub const INIT: OnceCell<T>
INIT: OnceCell<T> = OnceCell{inner: <AtomicPtr>::new(ptr::null_mut()), once: <Once>::new(),}
pub fn new() -> OnceCell<T>
[src]
pub fn new() -> OnceCell<T>
pub fn get(&self) -> Option<&T>
[src]
pub fn get(&self) -> Option<&T>
pub fn set(&'static self, value: T) -> Result<(), T>
[src]
pub fn set(&'static self, value: T) -> Result<(), T>
pub fn get_or_init(
&'static self,
f: impl FnOnce() -> T
) -> &T
[src]
pub fn get_or_init(
&'static self,
f: impl FnOnce() -> T
) -> &T
Guarantees that only one f
is ever called.