Struct once_cell::unsync::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: <UnsafeCell>::new(None),}
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(&self, value: T) -> Result<(), T>
[src]
pub fn set(&self, value: T) -> Result<(), T>
pub fn get_or_init(
&self,
f: impl FnOnce() -> T
) -> &T
[src]
pub fn get_or_init(
&self,
f: impl FnOnce() -> T
) -> &T
pub fn get_or_try_init<E>(
&self,
f: impl FnOnce() -> Result<T, E>
) -> Result<&T, E>
[src]
pub fn get_or_try_init<E>(
&self,
f: impl FnOnce() -> Result<T, E>
) -> Result<&T, E>
Trait Implementations
impl<T: Debug> Debug for OnceCell<T>
[src]
impl<T: Debug> Debug for OnceCell<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Default> Default for OnceCell<T>
[src]
impl<T: Default> Default for OnceCell<T>