Struct LazyKey

pub struct LazyKey { pub(in ::sys::thread_local::key::racy) key: Atomic<usize>, pub(in ::sys::thread_local::key::racy) dtor: Option<unsafe extern "C" fn(*mut u8)> }

A type for TLS keys that are statically allocated.

This is basically a LazyLock<Key>, but avoids blocking and circular dependencies with the rest of std.

Fields

key: Atomic<usize>

Inner static TLS key (internals).

dtor: Option<unsafe extern "C" fn(*mut u8)>

Destructor for the TLS value.

Implementations

impl LazyKey

const fn new(dtor: Option<unsafe extern "C" fn(*mut u8)>) -> LazyKey
fn force(&self) -> pthread_key_t
fn lazy_init(&self) -> usize

Auto Trait Implementations

impl !Freeze for LazyKey

impl RefUnwindSafe for LazyKey

impl Send for LazyKey

impl Sync for LazyKey

impl Unpin for LazyKey

impl UnsafeUnpin for LazyKey

impl UnwindSafe for LazyKey

Blanket Implementations

impl<T> Any for LazyKey where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for LazyKey where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for LazyKey where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for LazyKey

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for LazyKey where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for LazyKey

impl<T, U> Into<U> for LazyKey where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for LazyKey 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 LazyKey where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>