sycamore::web::js_sys::wasm_bindgen::convert

Trait LongRefFromWasmAbi

source
pub trait LongRefFromWasmAbi: WasmDescribe {
    type Abi: WasmAbi;
    type Anchor: Borrow<Self>;

    // Required method
    unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor;
}
Expand description

A version of the RefFromWasmAbi trait with the additional requirement that the reference must remain valid as long as the anchor isn’t dropped.

This isn’t the case for JsValue’s RefFromWasmAbi implementation. To avoid having to allocate a spot for the JsValue on the JsValue heap, the JsValue is instead pushed onto the JsValue stack, and popped off again after the function that the reference was passed to returns. So, JsValue has a different LongRefFromWasmAbi implementation that behaves the same as FromWasmAbi, putting the value on the heap.

This is needed for async functions, where the reference needs to be valid for the whole length of the Future, rather than the initial synchronous call.

‘long ref’ is short for ‘long-lived reference’.

§⚠️ Unstable

This is part of the internal convert module, no stability guarantees are provided. Use at your own risk. See its documentation for more details.

Required Associated Types§

source

type Abi: WasmAbi

Same as RefFromWasmAbi::Abi

source

type Anchor: Borrow<Self>

Same as RefFromWasmAbi::Anchor

Required Methods§

source

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl LongRefFromWasmAbi for str

source§

impl LongRefFromWasmAbi for CharacterData

source§

impl LongRefFromWasmAbi for Comment

source§

impl LongRefFromWasmAbi for Document

source§

impl LongRefFromWasmAbi for DocumentFragment

source§

impl LongRefFromWasmAbi for Element

source§

impl LongRefFromWasmAbi for EventListener

source§

impl LongRefFromWasmAbi for EventTarget

source§

impl LongRefFromWasmAbi for HtmlElement

source§

impl LongRefFromWasmAbi for Node

source§

impl LongRefFromWasmAbi for NodeList

source§

impl LongRefFromWasmAbi for Text

source§

impl LongRefFromWasmAbi for Window

source§

impl LongRefFromWasmAbi for [f32]

source§

impl LongRefFromWasmAbi for [f64]

source§

impl LongRefFromWasmAbi for [i8]

source§

impl LongRefFromWasmAbi for [i16]

source§

impl LongRefFromWasmAbi for [i32]

source§

impl LongRefFromWasmAbi for [i64]

source§

impl LongRefFromWasmAbi for [isize]

source§

impl LongRefFromWasmAbi for [u8]

source§

impl LongRefFromWasmAbi for [u16]

source§

impl LongRefFromWasmAbi for [u32]

source§

impl LongRefFromWasmAbi for [u64]

source§

impl LongRefFromWasmAbi for [usize]

Implementors§

source§

impl LongRefFromWasmAbi for AnimationEvent

source§

impl LongRefFromWasmAbi for BeforeUnloadEvent

source§

impl LongRefFromWasmAbi for CompositionEvent

source§

impl LongRefFromWasmAbi for DeviceMotionEvent

source§

impl LongRefFromWasmAbi for DeviceOrientationEvent

source§

impl LongRefFromWasmAbi for DragEvent

source§

impl LongRefFromWasmAbi for ErrorEvent

source§

impl LongRefFromWasmAbi for Event

source§

impl LongRefFromWasmAbi for FocusEvent

source§

impl LongRefFromWasmAbi for GamepadEvent

source§

impl LongRefFromWasmAbi for HashChangeEvent

source§

impl LongRefFromWasmAbi for InputEvent

source§

impl LongRefFromWasmAbi for KeyboardEvent

source§

impl LongRefFromWasmAbi for MessageEvent

source§

impl LongRefFromWasmAbi for MouseEvent

source§

impl LongRefFromWasmAbi for PageTransitionEvent

source§

impl LongRefFromWasmAbi for PointerEvent

source§

impl LongRefFromWasmAbi for PopStateEvent

source§

impl LongRefFromWasmAbi for ProgressEvent

source§

impl LongRefFromWasmAbi for PromiseRejectionEvent

source§

impl LongRefFromWasmAbi for SecurityPolicyViolationEvent

source§

impl LongRefFromWasmAbi for StorageEvent

source§

impl LongRefFromWasmAbi for SubmitEvent

source§

impl LongRefFromWasmAbi for TouchEvent

source§

impl LongRefFromWasmAbi for TransitionEvent

source§

impl LongRefFromWasmAbi for UiEvent

source§

impl LongRefFromWasmAbi for WheelEvent

source§

impl LongRefFromWasmAbi for Collator

source§

impl LongRefFromWasmAbi for DateTimeFormat

source§

impl LongRefFromWasmAbi for NumberFormat

source§

impl LongRefFromWasmAbi for PluralRules

source§

impl LongRefFromWasmAbi for RelativeTimeFormat

source§

impl LongRefFromWasmAbi for CompileError

source§

impl LongRefFromWasmAbi for Exception

source§

impl LongRefFromWasmAbi for Global

source§

impl LongRefFromWasmAbi for Instance

source§

impl LongRefFromWasmAbi for LinkError

source§

impl LongRefFromWasmAbi for Memory

source§

impl LongRefFromWasmAbi for Module

source§

impl LongRefFromWasmAbi for RuntimeError

source§

impl LongRefFromWasmAbi for Table

source§

impl LongRefFromWasmAbi for Tag

source§

impl LongRefFromWasmAbi for Array

source§

impl LongRefFromWasmAbi for ArrayBuffer

source§

impl LongRefFromWasmAbi for AsyncIterator

source§

impl LongRefFromWasmAbi for BigInt64Array

source§

impl LongRefFromWasmAbi for BigInt

source§

impl LongRefFromWasmAbi for BigUint64Array

source§

impl LongRefFromWasmAbi for Boolean

source§

impl LongRefFromWasmAbi for DataView

source§

impl LongRefFromWasmAbi for Date

source§

impl LongRefFromWasmAbi for Error

source§

impl LongRefFromWasmAbi for EvalError

source§

impl LongRefFromWasmAbi for Float32Array

source§

impl LongRefFromWasmAbi for Float64Array

source§

impl LongRefFromWasmAbi for Function

source§

impl LongRefFromWasmAbi for Generator

source§

impl LongRefFromWasmAbi for Int8Array

source§

impl LongRefFromWasmAbi for Int16Array

source§

impl LongRefFromWasmAbi for Int32Array

source§

impl LongRefFromWasmAbi for Iterator

source§

impl LongRefFromWasmAbi for IteratorNext

source§

impl LongRefFromWasmAbi for JsString

source§

impl LongRefFromWasmAbi for Map

source§

impl LongRefFromWasmAbi for Number

source§

impl LongRefFromWasmAbi for Object

source§

impl LongRefFromWasmAbi for Promise

source§

impl LongRefFromWasmAbi for Proxy

source§

impl LongRefFromWasmAbi for RangeError

source§

impl LongRefFromWasmAbi for ReferenceError

source§

impl LongRefFromWasmAbi for RegExp

source§

impl LongRefFromWasmAbi for Set

source§

impl LongRefFromWasmAbi for SharedArrayBuffer

source§

impl LongRefFromWasmAbi for Symbol

source§

impl LongRefFromWasmAbi for SyntaxError

source§

impl LongRefFromWasmAbi for TypeError

source§

impl LongRefFromWasmAbi for Uint8Array

source§

impl LongRefFromWasmAbi for Uint8ClampedArray

source§

impl LongRefFromWasmAbi for Uint16Array

source§

impl LongRefFromWasmAbi for Uint32Array

source§

impl LongRefFromWasmAbi for UriError

source§

impl LongRefFromWasmAbi for WeakMap

source§

impl LongRefFromWasmAbi for WeakSet

source§

impl LongRefFromWasmAbi for JsValue