Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more types in Result<(), E> for #[wasm_bindgen(start)] #3262

Closed
daxpedda opened this issue Jan 24, 2023 · 0 comments · Fixed by #3299
Closed

Support more types in Result<(), E> for #[wasm_bindgen(start)] #3262

daxpedda opened this issue Jan 24, 2023 · 0 comments · Fixed by #3299

Comments

@daxpedda
Copy link
Collaborator

daxpedda commented Jan 24, 2023

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 with Termination, which is what is expected in fn main() by Rust.

Currently the return error type has to be a JsValue or (), but very commonly error types like anyhow::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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant