Trait static_init::lazy::LazyAccess
source · pub trait LazyAccess: Sized {
type Target;
// Required methods
fn get(this: Self) -> Self::Target;
fn try_get(this: Self) -> Result<Self::Target, AccessError>;
fn phase(this: Self) -> Phase;
fn init(this: Self) -> Phase;
}
Expand description
Helper trait to ease access static lazy associated functions
Required Associated Types§
Required Methods§
sourcefn get(this: Self) -> Self::Target
fn get(this: Self) -> Self::Target
Initialize if necessary then return a reference to the target.
§Panics
Panic if previous attempt to initialize has panicked and the lazy policy does not tolorate further initialization attempt or if initialization panic.
sourcefn try_get(this: Self) -> Result<Self::Target, AccessError>
fn try_get(this: Self) -> Result<Self::Target, AccessError>
Return a reference to the target if initialized otherwise return an error.
Object Safety§
This trait is not object safe.