macro_rules! impl_complementary_wasm_traits {
($type_name:path) => { ... };
}Expand description
Implements complementary wasm traits for the given type. Needs impl_main_wasm_traits to be implemented first. It allows a type to be used on async functions normally or as ref or as Vec<> etc. 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_main_wasm_traits!(A);
impl_complementary_wasm_traits!(A);
#[wasm_bindgen]
pub async fn some_fn(arg: &A) -> Result<String, Error> {
// body
}