Expand description
Provides utilities, helpers and macros to easily build and customize wasm_bindgen bindings.
Modules§
Macros§
- add_
ts_ content - Adds/appends the given string literal to wasm bindgen typescript bindings.
This is just a sugar for wasm_bindgen
typescript_custom_section, so the given text can be anything, from typescript comment to type declarations or any other valid .d.ts content. - impl_
complementary_ wasm_ traits - 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.
- impl_
custom_ tsify - Implements tsify::Tsify with the given type declaration for the given rust type (structs and enums) identifier.
- impl_
main_ wasm_ traits - A macro that implements main wasm traits for the given type. These traits are the necessary ones to be able to send/receive the given type through wasm bindgen boundry. The type needs to have serde::Serialize, serde::Deserialize and tsify::Tsify traits implemented.
- impl_
wasm_ traits - 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.
Functions§
- bytes_
serilializer - Serializer fn for serializing Vec<u8> as bytes (Uint8Array for js) Example:
- serialize_
btreemap_ as_ object - Serializer fn that serializes BTreeMap as k/v object. in js it would be plain js object and not js Map.
- serialize_
hashmap_ as_ object - Serializer fn that serializes HashMap as k/v object. in js it would be plain js object and not js Map.