mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-26 19:21:35 +00:00
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:
@ -148,3 +148,22 @@ exports.js_conditional_bindings = () => {
|
||||
const x = new wasm.ConditionalBindings();
|
||||
x.free();
|
||||
};
|
||||
|
||||
exports.js_assert_none = x => {
|
||||
assert.strictEqual(x, undefined);
|
||||
};
|
||||
exports.js_assert_some = x => {
|
||||
assert.ok(x instanceof wasm.OptionClass);
|
||||
};
|
||||
exports.js_return_none1 = () => null;
|
||||
exports.js_return_none2 = () => undefined;
|
||||
exports.js_return_some = x => x;
|
||||
|
||||
exports.js_test_option_classes = () => {
|
||||
assert.strictEqual(wasm.option_class_none(), undefined);
|
||||
wasm.option_class_assert_none(undefined);
|
||||
wasm.option_class_assert_none(null);
|
||||
const c = wasm.option_class_some();
|
||||
assert.ok(c instanceof wasm.OptionClass);
|
||||
wasm.option_class_assert_some(c);
|
||||
};
|
||||
|
Reference in New Issue
Block a user