pub trait FromJSValConvertibleRc: Sized {
// Required method
unsafe fn from_jsval(
cx: *mut JSContext,
val: HandleValue<'_>,
) -> Result<ConversionResult<Rc<Self>>, ()>;
// Provided method
fn safe_from_jsval(
cx: &mut JSContext,
val: HandleValue<'_>,
) -> Result<ConversionResult<Rc<Self>>, ()> { ... }
}Expand description
A trait to convert JSVals to Rust types inside of Rc wrappers.
Required Methods§
Sourceunsafe fn from_jsval(
cx: *mut JSContext,
val: HandleValue<'_>,
) -> Result<ConversionResult<Rc<Self>>, ()>
unsafe fn from_jsval( cx: *mut JSContext, val: HandleValue<'_>, ) -> Result<ConversionResult<Rc<Self>>, ()>
Convert val to type Self.
If it returns Err(()), a JSAPI exception is pending.
If it returns Ok(Failure(reason)), there is no pending JSAPI exception.
Provided Methods§
Sourcefn safe_from_jsval(
cx: &mut JSContext,
val: HandleValue<'_>,
) -> Result<ConversionResult<Rc<Self>>, ()>
fn safe_from_jsval( cx: &mut JSContext, val: HandleValue<'_>, ) -> Result<ConversionResult<Rc<Self>>, ()>
Convert val to type Self.
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.