[][src]Struct sgx_tstd::thread::LocalKey

pub struct LocalKey<T: 'static> { /* fields omitted */ }

Methods

impl<T: 'static> LocalKey<T>[src]

pub const unsafe fn new(
    inner: unsafe fn() -> Result<&'static T, AccessError>
) -> LocalKey<T>
[src]

pub fn with<F, R>(&'static self, f: F) -> R where
    F: FnOnce(&T) -> R, 
[src]

Acquires a reference to the value in this TLS key.

This will lazily initialize the value if this thread has not referenced this key yet.

Panics

This function will panic!() if TLS data needs to be destructed, TCS policy must be Bound.

pub fn try_with<F, R>(&'static self, f: F) -> Result<R, AccessError> where
    F: FnOnce(&T) -> R, 
[src]

Acquires a reference to the value in this TLS key.

This will lazily initialize the value if this thread has not referenced this key yet. If the key has been destroyed (which may happen if this is called in a destructor), this function will return an AccessError.

Panics

This function will still panic!() if the key is uninitialized and the key's initializer panics.

Trait Implementations

impl<T: 'static> Debug for LocalKey<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for LocalKey<T>

impl<T> Send for LocalKey<T>

impl<T> Sync for LocalKey<T>

impl<T> Unpin for LocalKey<T>

impl<T> UnwindSafe for LocalKey<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.