You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to create a couple macros that will handle automatic code generation of these repetitive impl blocks. The macros would generate the same code as above, and might be used like so:
#[wasm_bindgen]
#[foreign_type_wrapper]
pub struct WrapperType(ForeignType);
#[wasm_bindgen]
#[foreign_enum_wrapper(ForeignEnum)]
pub enum WrapperEnum {
// the variants should be generated by the macro too
}
by the way, a macro must be defined in its own crate with this in Cargo.toml:
We often use this pattern to be able to use the
wasmbingen
macro and implement traits on foreign types from Warp:Another frequent similar case is where we wrap a foreign enum for the same reasons:
We want to create a couple macros that will handle automatic code generation of these repetitive
impl
blocks. The macros would generate the same code as above, and might be used like so:by the way, a macro must be defined in its own crate with this in
Cargo.toml
:See: https://doc.rust-lang.org/book/ch19-06-macros.html
The text was updated successfully, but these errors were encountered: