Support Option<RustStruct> in arguments/returns

Add all the necessary support in a few locations and we should be good
to go!

Closes #1252
This commit is contained in:
Alex Crichton
2019-02-19 09:08:37 -08:00
parent e498d99b2d
commit f831711f5d
5 changed files with 145 additions and 35 deletions

View File

@ -248,6 +248,17 @@ impl ToTokens for ast::Struct {
(*js).borrow_mut()
}
}
impl ::wasm_bindgen::convert::OptionIntoWasmAbi for #name {
#[inline]
fn none() -> Self::Abi { 0 }
}
impl ::wasm_bindgen::convert::OptionFromWasmAbi for #name {
#[inline]
fn is_none(abi: &Self::Abi) -> bool { *abi == 0 }
}
})
.to_tokens(tokens);