pub enum InitError<E> {
InitFunctionFailed(E),
ConcurrentInitialization,
}Expand description
The cell could not be initialized.
Returned by OnceCell::get_or_try_init, which fails either
because the init function itself failed, or because another caller is already initializing the
cell.
Variants§
InitFunctionFailed(E)
The init function returned an error.
The cell is left uninitialized, so the operation can be retried.
ConcurrentInitialization
There is another init function running concurrently for the same OnceCell.
The init function of this call was not executed. It is dropped together with everything
that it captured, so it cannot be reused for a retry. See
OnceCell::get_or_try_init for how to keep ownership
of captured resources, and ConcurrentInitialization for details on the error itself.
Implementations§
Source§impl<E> InitError<E>
impl<E> InitError<E>
Sourcepub fn init_function_error(self) -> Option<E>
pub fn init_function_error(self) -> Option<E>
Returns the error of the init function, or None for a
ConcurrentInitialization error.
Trait Implementations§
impl<E: Copy> Copy for InitError<E>
impl<E: Eq> Eq for InitError<E>
Source§impl<E: Error + 'static> Error for InitError<E>
impl<E: Error + 'static> Error for InitError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()