pub trait ToJsValue: Sized {
type ReturnAbi: ReturnWasmAbi + IntoWasmAbi;
// Required methods
fn to_js_value(&self) -> JsValue;
fn into_return_abi(self) -> Result<Self::ReturnAbi, JsValue>;
// Provided methods
fn number_of_args() -> u32 { ... }
fn to_function_args(&self) -> Array { ... }
fn create_array_of_size(size: u32) -> JsValue { ... }
}
Required Associated Types§
type ReturnAbi: ReturnWasmAbi + IntoWasmAbi
Required Methods§
fn to_js_value(&self) -> JsValue
Sourcefn into_return_abi(self) -> Result<Self::ReturnAbi, JsValue>
fn into_return_abi(self) -> Result<Self::ReturnAbi, JsValue>
When this is returned from a closure
Provided Methods§
Sourcefn number_of_args() -> u32
fn number_of_args() -> u32
Number of function arguments when this type is used as a function input type
Sourcefn to_function_args(&self) -> Array
fn to_function_args(&self) -> Array
Convert to function arguments when calling a function with this value
Sourcefn create_array_of_size(size: u32) -> JsValue
fn create_array_of_size(size: u32) -> JsValue
When converting Vec
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.