pub struct JsThreadLocal<T>where
T: 'static,{ /* private fields */ }Expand description
A thread-local accessor for lazily initialized JavaScript values.
This type provides safe access to cached JavaScript global values,
ensuring the value is initialized on first access. You can access
the value directly via Deref.
§Example
ⓘ
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(thread_local_v2, js_name = window)]
pub static WINDOW: Window;
}
// Access the cached window value directly
let doc = WINDOW.document();Implementations§
Auto Trait Implementations§
impl<T> Freeze for JsThreadLocal<T>
impl<T> RefUnwindSafe for JsThreadLocal<T>
impl<T> Send for JsThreadLocal<T>
impl<T> Sync for JsThreadLocal<T>
impl<T> Unpin for JsThreadLocal<T>
impl<T> UnwindSafe for JsThreadLocal<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more