Struct LazyStorage
#[repr(C)]
pub struct LazyStorage<T, D> { pub(in ::sys::thread_local::native::lazy) value: UnsafeCell<MaybeUninit<T>>, pub(in ::sys::thread_local::native::lazy) state: Cell<State<D>> }
Fields
value: UnsafeCell<MaybeUninit<T>>state: Cell<State<D>>
Implementations
impl<T, D> Storage<T, D>
where
D: DestroyedState,
const fn new() -> Storage<T, D>unsafe fn get_or_init(&self, i: Option<&mut Option<T>>, f: impl FnOnce() -> T) -> *const TGets a pointer to the TLS value, potentially initializing it with the provided parameters. If the TLS variable has been destroyed, a null pointer is returned.
The resulting pointer may not be used after reentrant inialialization or thread destruction has occurred.
Safety
The
selfreference must remain valid until the TLS destructor is run.unsafe fn get_or_init_slow(&self, i: Option<&mut Option<T>>, f: impl FnOnce() -> T) -> *const TSafety
The
selfreference must remain valid until the TLS destructor is run.
Auto Trait Implementations
impl<T, D> !Freeze for Storage<T, D>
impl<T, D> !RefUnwindSafe for Storage<T, D>
impl<T, D> !Sync for Storage<T, D>
impl<T, D> Send for Storage<T, D>
where
UnsafeCell<MaybeUninit<T>>: Send,
Cell<State<D>>: Send,
impl<T, D> Unpin for Storage<T, D>
where
UnsafeCell<MaybeUninit<T>>: Unpin,
Cell<State<D>>: Unpin,
impl<T, D> UnsafeUnpin for Storage<T, D>
where
UnsafeCell<MaybeUninit<T>>: UnsafeUnpin,
Cell<State<D>>: UnsafeUnpin,
impl<T, D> UnwindSafe for Storage<T, D>
where
UnsafeCell<MaybeUninit<T>>: UnwindSafe,
Cell<State<D>>: UnwindSafe,
Blanket Implementations
impl<T> Any for Storage<T, D>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Storage<T, D>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Storage<T, D>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Storage<T, D>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Storage<T, D>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Storage<T, D>
impl<T, U> Into<U> for Storage<T, D>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Storage<T, D>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Storage<T, D>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>