Trait Tsify

Source
pub trait Tsify {
    type JsType: JsCast;

    const DECL: &'static str;
    const SERIALIZATION_CONFIG: SerializationConfig = _;

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

Tsify is a trait that allows you to convert a type to and from JavaScript. Can be implemented manually if you need to customize the serialization or deserialization.

Required Associated Constants§

Source

const DECL: &'static str

Provided Associated Constants§

Required Associated Types§

Provided Methods§

Source

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

Source

fn from_js<T: Into<JsValue>>(js: T) -> Result<Self>
where 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§