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§

source

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.

source

fn try_get(this: Self) -> Result<Self::Target, AccessError>

Return a reference to the target if initialized otherwise return an error.

source

fn phase(this: Self) -> Phase

The current phase of the static

source

fn init(this: Self) -> Phase

Initialize the static if there were no previous attempt to initialize it.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T, G> LazyAccess for &'a Lazy<T, G>
where G: Generator<T>,

source§

impl<'a, T, G> LazyAccess for &'a UnSyncLazy<T, G>
where G: Generator<T>,

source§

impl<T, G> LazyAccess for &'static LazyFinalize<T, G>
where G: 'static + Generator<T> + Sync, T: Sync + Finaly,

source§

impl<T, G> LazyAccess for &'static LesserLazy<T, G>
where G: 'static + Generator<T>,

source§

impl<T, G> LazyAccess for &'static LesserLazyFinalize<T, G>
where G: 'static + Generator<T> + Sync, T: Sync + Finaly,