Struct JsThreadLocal

pub struct JsThreadLocal<T: 'static> { /* private fields */ }

Wrapper type for imported statics.

This type is used whenever a static is imported from a JS module, for example this import:

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(thread_local_v2)]
    static console: JsValue;
}

will generate in Rust a value that looks like:

static console: JsThreadLocal<JsValue> = ...;

Implementations

impl<T> JsThreadLocal<T>

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

Auto Trait Implementations

impl<T> Freeze for JsThreadLocal<T> where &'static LazyCell<T>: Freeze,

impl<T> RefUnwindSafe for JsThreadLocal<T> where &'static LazyCell<T>: RefUnwindSafe,

impl<T> Send for JsThreadLocal<T> where &'static LazyCell<T>: Send,

impl<T> Sync for JsThreadLocal<T> where &'static LazyCell<T>: Sync,

impl<T> Unpin for JsThreadLocal<T> where &'static LazyCell<T>: Unpin,

impl<T> UnsafeUnpin for JsThreadLocal<T> where &'static LazyCell<T>: UnsafeUnpin,

impl<T> UnwindSafe for JsThreadLocal<T> where &'static LazyCell<T>: UnwindSafe,

Blanket Implementations

impl<S, T> Upcast<T> for JsThreadLocal<T> where T: UpcastFrom<S> + ?Sized, S: ?Sized,

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

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

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

impl<T> From<T> for JsThreadLocal<T>

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

impl<T, U> TryFrom<U> for JsThreadLocal<T> where U: Into<T>,

impl<T, U> TryInto<U> for JsThreadLocal<T> where U: TryFrom<T>,