pub trait TryFromJsArgument<'a>: Sized {
// Required method
fn try_from_js_argument(
this: &'a JsValue,
rest: &'a [JsValue],
context: &mut Context,
) -> JsResult<(Self, &'a [JsValue])>;
}Expand description
Create a Rust value from a JS argument. This trait is used to convert arguments from JS to Rust types. It allows support for optional arguments or rest arguments.
Required Methods§
Sourcefn try_from_js_argument(
this: &'a JsValue,
rest: &'a [JsValue],
context: &mut Context,
) -> JsResult<(Self, &'a [JsValue])>
fn try_from_js_argument( this: &'a JsValue, rest: &'a [JsValue], context: &mut Context, ) -> JsResult<(Self, &'a [JsValue])>
Try to convert a JS argument into a Rust value, returning the value and the rest of the arguments to be parsed.
§Errors
Any parsing errors that may occur during the conversion.
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.