pub(crate) trait FromJSValConvertible: Sized {
type Config;
// Required method
unsafe fn from_jsval(
cx: *mut JSContext,
val: Handle<'_, Value>,
option: Self::Config,
) -> Result<ConversionResult<Self>, ()>;
}
Expand description
A trait to convert JSVal
s to Rust types.
Required Associated Types§
Required Methods§
Sourceunsafe fn from_jsval(
cx: *mut JSContext,
val: Handle<'_, Value>,
option: Self::Config,
) -> Result<ConversionResult<Self>, ()>
unsafe fn from_jsval( cx: *mut JSContext, val: Handle<'_, Value>, option: Self::Config, ) -> Result<ConversionResult<Self>, ()>
Convert val
to type Self
.
Optional configuration of type T
can be passed as the option
argument.
If it returns Err(())
, a JSAPI exception is pending.
If it returns Ok(Failure(reason))
, there is no pending JSAPI exception.
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.