Struct static_init::UnSyncLazy [−][src]
A version of Lazy whose reference can not be passed to other thread
Implementations
impl<T, G> UnSyncLazy<T, G>
[src]
pub const fn from_generator(f: G) -> Self
[src]
Build a new static object
Safety
This function may be unsafe if building any thing else than a thread local object or a static will be the cause of undefined behavior
pub const fn from_generator_with_info(f: G, info: StaticInfo) -> Self
[src]
Build a new static object with debug information
Safety
This function may be unsafe if building any thing else than a thread local object or a static will be the cause of undefined behavior
impl<T, G> UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
pub fn get(this: &Self) -> &T
[src]
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.
pub fn try_get(this: &Self) -> Result<&T, AccessError>
[src]
Return a reference to the target if initialized otherwise return an error.
pub fn get_mut(this: &mut Self) -> &mut T
[src]
Initialize and return a mutable reference to the target
This method is extremly efficient as it does not requires any form of locking when initializing
pub fn try_get_mut(this: &mut Self) -> Result<&mut T, AccessError>
[src]
Return a mutable reference to the target if initialized otherwise return an error.
This method is extremly efficient as it does not requires any form of locking when initializing
pub fn phase(this: &Self) -> Phase
[src]
Return the phase
pub fn init(this: &Self) -> Phase
[src]
impl<T, G> UnSyncLazy<T, Cell<Option<G>>> where
G: FnOnce() -> T,
[src]
G: FnOnce() -> T,
Trait Implementations
impl<T: Debug, G> Debug for UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
impl<T: Default> Default for UnSyncLazy<T, fn() -> T>
[src]
impl<T, G> Deref for UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
impl<T, G> DerefMut for UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
impl<T, G> Drop for UnSyncLazy<T, G>
[src]
impl<'a, T, G> LazyAccess for &'a UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
type Target = &'a T
fn get(this: Self) -> &'a T
[src]
fn try_get(this: Self) -> Result<&'a T, AccessError>
[src]
fn phase(this: Self) -> Phase
[src]
fn init(this: Self) -> Phase
[src]
impl<T, G> Phased for UnSyncLazy<T, G> where
G: Generator<T>,
[src]
G: Generator<T>,
Auto Trait Implementations
impl<T, G> RefUnwindSafe for UnSyncLazy<T, G> where
G: RefUnwindSafe,
T: RefUnwindSafe,
G: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, G = fn() -> T> !Send for UnSyncLazy<T, G>
impl<T, G = fn() -> T> !Sync for UnSyncLazy<T, G>
impl<T, G> Unpin for UnSyncLazy<T, G> where
G: Unpin,
T: Unpin,
G: Unpin,
T: Unpin,
impl<T, G> UnwindSafe for UnSyncLazy<T, G> where
G: UnwindSafe,
T: UnwindSafe,
G: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,