pub trait AsJs {
// Required methods
fn to_js(&self) -> Result<JsValue, JsValue>;
fn from_js(js_value: JsValue) -> Result<Self, JsValue>
where Self: Sized;
}Expand description
An object-safe version of
std::convert::TryInto/std::convert::TryFrom, relying on the
JavaScript GC.
Required Methods§
Sourcefn to_js(&self) -> Result<JsValue, JsValue>
fn to_js(&self) -> Result<JsValue, JsValue>
Retrieve the JavaScript representation of a value.
§Errors
If the value could not be represented as a JavaScript value.