pub trait JsStateConvert: Sized {
// Required methods
fn to_js_value(&self) -> JsValue;
fn from_js_value(val: JsValue) -> Result<Self, String>;
}Expand description
Trait for converting between Rust states and their JavaScript wrappers.
Required Methods§
Sourcefn to_js_value(&self) -> JsValue
fn to_js_value(&self) -> JsValue
Convert the Rust state to a JavaScript wrapper object.
Sourcefn from_js_value(val: JsValue) -> Result<Self, String>
fn from_js_value(val: JsValue) -> Result<Self, String>
Convert a JavaScript wrapper object back to the Rust state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".