Add From/Into JsValue for imported types

This commit is contained in:
Alex Crichton 2018-03-21 12:37:10 -07:00
parent 48b34604cb
commit fc81d8f6d3

View File

@ -369,6 +369,18 @@ impl ToTokens for ast::ImportType {
self.obj.to_js_ref()
}
}
impl From<::wasm_bindgen::JsValue> for #name {
fn from(obj: ::wasm_bindgen::JsValue) -> #name {
#name { obj }
}
}
impl From<#name> for ::wasm_bindgen::JsValue {
fn from(obj: #name) -> ::wasm_bindgen::JsValue {
obj.obj
}
}
}).to_tokens(tokens);
}
}