Expand description
How a type crosses the wasm ABI.
A proc macro cannot resolve types: seeing the token CipherView, #[wasm_export] has no way to
know whether it is a serde DTO, which crosses as Ts<T>, a #[wasm_bindgen]
handle, which crosses as itself, or a type that crosses as a string. So each type declares its
own wire form instead. FromWasm::Wire and ToWasm::Wire are what the generated shim puts
in its signature, and #[wasm_record] / #[wasm_object] generate the impls.
Conversion happens inside the shim body, where a failure is an ordinary Err and destructors
run. #[tsify(from_wasm_abi)] instead converts inside FromWasmAbi::from_abi, which cannot
report failure and so calls wasm_bindgen::throw_str
(tsify#65).
Enums§
- Never
- Stands in for the error of a shim whose underlying method cannot fail.
- TsError
- Error of a generated shim.
- Wire
Error - A value could not be converted across the wasm ABI.
Traits§
- From
Wasm - A type that can be received from JavaScript, crossing the ABI as
Self::Wire. - ToWasm
- A type that can be handed to JavaScript, crossing the ABI as
Self::Wire.