LazyAccess

Trait 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.

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.

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,