Alex Crichton 7cf4213283 Allow returning Result from functions
This commit adds support for exporting a function defined in Rust that returns a
`Result`, translating the `Ok` variant to the actual return value and the `Err`
variant to an exception that's thrown in JS.

The support for return types and descriptors was rejiggered a bit to be a bit
more abstract and more well suited for this purpose. We no longer distinguish
between functions with a return value and those without a return value.
Additionally a new trait, `ReturnWasmAbi`, is used for converting return values.
This trait is an internal implementation detail, however, and shouldn't surface
itself to users much (if at all).

Closes #841
2018-09-18 13:13:59 -07:00

36 lines
679 B
Rust

#![cfg(target_arch = "wasm32")]
extern crate js_sys;
extern crate wasm_bindgen_test;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test_crate_a;
extern crate wasm_bindgen_test_crate_b;
#[cfg(feature = "serde-serialize")]
#[macro_use]
extern crate serde_derive;
pub mod api;
pub mod char;
pub mod classes;
pub mod closures;
pub mod comments;
pub mod duplicate_deps;
pub mod duplicates;
pub mod enums;
pub mod import_class;
pub mod imports;
pub mod js_objects;
pub mod jscast;
pub mod math;
pub mod node;
pub mod option;
pub mod optional_primitives;
pub mod rethrow;
pub mod simple;
pub mod slice;
pub mod structural;
pub mod u64;
pub mod validate_prt;
pub mod variadic;