Tsify

Trait Tsify 

Source
pub trait Tsify {
    type JsType: JsCast;

    const DECL: &'static str;

    // Provided methods
    fn into_js(&self) -> Result<Self::JsType, Error>
       where Self: Serialize { ... }
    fn from_js<T>(js: T) -> Result<Self, Error>
       where T: Into<JsValue>,
             Self: DeserializeOwned { ... }
}

Required Associated Constants§

Source

const DECL: &'static str

Required Associated Types§

Provided Methods§

Source

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

Source

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

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.

Implementors§

Source§

impl Tsify for WasmEncodedError

Source§

const DECL: &'static str = "export interface WasmEncodedError {\n msg: string;\n readableMsg: string;\n}"

Source§

type JsType = JsType

Source§

impl<T> Tsify for WasmEncodedResult<T>

Source§

const DECL: &'static str = "export type WasmEncodedResult<T> = { value: T; error: undefined } | { value: undefined; error: WasmEncodedError };"

Source§

type JsType = JsType