Struct Storage
#[repr(C)]
pub struct Storage<T> { pub(in ::sys::thread_local::native::eager) val: UnsafeCell<T>, pub(in ::sys::thread_local::native::eager) state: Cell<State> }
Fields
val: UnsafeCell<T>state: Cell<State>
Implementations
impl<T> Storage<T>
const fn new(val: T) -> Storage<T>unsafe fn get(&self) -> *const TGets a pointer to the TLS value. If the TLS variable has been destroyed, a null pointer is returned.
The resulting pointer may not be used after thread destruction has occurred.
Safety
The
selfreference must remain valid until the TLS destructor is run.unsafe fn get_or_init_slow(&self) -> *const T
Auto Trait Implementations
impl<T> !Freeze for Storage<T>
impl<T> !RefUnwindSafe for Storage<T>
impl<T> !Sync for Storage<T>
impl<T> Send for Storage<T>
where
UnsafeCell<T>: Send,
impl<T> Unpin for Storage<T>
where
UnsafeCell<T>: Unpin,
impl<T> UnsafeUnpin for Storage<T>
where
UnsafeCell<T>: UnsafeUnpin,
impl<T> UnwindSafe for Storage<T>
where
UnsafeCell<T>: UnwindSafe,
Blanket Implementations
impl<T> Any for Storage<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Storage<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Storage<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Storage<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Storage<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Storage<T>
impl<T, U> Into<U> for Storage<T>
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>
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>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>