Support more types in Result<(), E>
for #[wasm_bindgen(start)]
#3262
Labels
Result<(), E>
for #[wasm_bindgen(start)]
#3262
Motivation
Reducing code duplication in cross-platform code-bases by getting as close as possible to what
fn main()
supports.I would argue that #2994 and #2970 are also cross-platform issues, because error libraries are usually not targeted towards
wasm-bindgen
but all sorts of targets.See #3076 and #3252 for more
fn main()
compatibility.Proposed Solution
Make
#[wasm_bindgen(start)]
as compatible as possible withTermination
, which is what is expected infn main()
by Rust.Currently the return error type has to be a
JsValue
or()
, but very commonly error types likeanyhow::Error
are used.We should still continue supporting
JsValue
at the same time.Alternatives
I don't know of any alternative for
wasm-bindgen
to apply here. This can always be solved on the user side with more#[cfg(...)]
s.The text was updated successfully, but these errors were encountered: