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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.