Skip to main content

Module convert

Module convert 

Source
Expand description

§⚠️ Unstable

This is an internal module, no stability guarantees are provided. Use at your own risk.

Structs§

WasmRet
A repr(C) struct containing all of the primitives of a WasmAbi type, in order.
WasmSlice
⚠️ Unstable

Traits§

FromCaughtException
The return type of a catch import that isn’t a Result: a synchronous JS throw is returned as from_caught_exception(e). js-sys implements it for Promise<T> as a rejected promise, so the throw arrives at .await.
FromWasmAbi
A trait for anything that can be recovered by-value from the Wasm ABI boundary, eg a Rust u8 can be recovered from the Wasm ABI u32 type.
IntoJsGeneric
Value conversion from a type into its canonical JsGeneric form.
IntoWasmAbi
A trait for anything that can be converted into a type that can cross the Wasm ABI directly, eg u32 or f64.
JsGeneric
A convenience trait for types that erase to JsValue.
JsStringLike
Marker for types that cross the ABI as a JavaScript string.
LongRefFromWasmAbi
A version of the RefFromWasmAbi trait with the additional requirement that the reference must remain valid as long as the anchor isn’t dropped.
MaybeFromWasmAbi
The ABI of Option<Self> received from JS. See MaybeIntoWasmAbi.
MaybeIntoWasmAbi
The ABI of Option<Self>.
NullableFromWasmAbi
The Null test of Nullable<Self> received from JS. See NullableIntoWasmAbi.
NullableIntoWasmAbi
The Null value of Nullable<Self>, which shares the ABI of Option<Self> with a second spare value beside none.
OptionFromWasmAbi
Indicates that this type can be received from JS as Option<Self> over its own ABI. See OptionIntoWasmAbi.
OptionIntoWasmAbi
Indicates that this type can be passed to JS as Option<Self> over its own ABI, which has a spare value for None.
RefFromWasmAbi
A trait for anything that can be recovered as some sort of shared reference from the Wasm ABI boundary.
RefIntoWasmAbi
A type whose shared references can cross the Wasm ABI, i.e. for<'a> &'a Self: IntoWasmAbi.
RefMutFromWasmAbi
Dual of the RefFromWasmAbi trait, except for mutable references.
ReturnWasmAbi
A trait representing how to interpret the return value of a function for the Wasm ABI.
TryFromJsValue
TryFromJsValue is a trait for converting a JavaScript value (JsValue) into a Rust type. It is used by the wasm_bindgen proc-macro to allow conversion to user types.
Upcast
A trait for type-safe generic upcasting.
UpcastFrom
A trait for defining upcast relationships from a source type.
VectorFromWasmAbi
Trait for element types to implement FromWasmAbi for vectors of themselves.
VectorIntoWasmAbi
Trait for element types to implement IntoWasmAbi for vectors of themselves.
VectorRefIntoWasmAbi
How a borrowed &[Self] crosses to JS.
WasmAbi
A trait which represents types that can be passed across the Wasm ABI boundary, by being split into multiple Wasm primitive types.
WasmPrimitive
A trait for any type which maps to a Wasm primitive type when used in FFI (i32, i64, f32, or f64).

Functions§

js_value_vector_from_abi⚠
The mirror of js_value_vector_into_abi, checking each element with TryFromJsValue.
js_value_vector_into_abi
The compat form of an owned vector: an in-place sequence of JsValue handles, converted to or from T in Rust. The released Vec<String>, Vecs of exported structs and numeric enums, and third-party impls cross this way. It has no new uses: an element whose single value crosses without calling into wasm is declared as an encoded sequence instead.
try_js_value_vector_from_abi⚠
The fallible form of js_value_vector_from_abi.