Macro impl_wasm_traits

Source
macro_rules! impl_wasm_traits {
    ($type_name:path) => { ... };
}
Expand description

Implement all wasm traits for the given type. that is impl_main_wasm_traits and impl_complementary_wasm_traits. The type needs to have serde::Serialize, serde::Deserialize and tsify::Tsify traits implemented.

Example:

#[derive(Serialize, Deserialize, Tsify)]
#[serde(rename_all = "camelCase")]
pub struct A {
    pub field: String,
    pub other_field: u8,
}
impl_wasm_traits!(A);

#[wasm_bindgen]
pub fn some_fn(arg: Vec<A>) -> String {
    // body
}