pub trait JsCast: AsRef<JsValue> + Into<JsValue> {
// Required methods
fn unchecked_from_js(val: JsValue) -> Self;
fn unchecked_from_js_ref(val: &JsValue) -> &Self;
// Provided methods
fn unchecked_into<T>(self) -> T
where T: JsCast { ... }
fn unchecked_ref<T>(&self) -> &T
where T: JsCast { ... }
}
Expand description
For converting between JavaScript types.
Note that most class types generated by WSDOM also comes with Into
and AsRef
impls for converting to their ancestors in the inheritance chain.
Required Methods§
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
Provided Methods§
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
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.