You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The official docs are a bit wrong - the function tagged with #[wasm_bindgen(start)] can also return all types that wasm_bindgen can transform to a consumable form for JS. In practice, this means you can return everything that implements FromWasmAbi. See e.g. Box<[JsValue]> in update_from_js example
error[E0277]: the trait bound `Box<[seed::prelude::JsValue]>: seed::prelude::wasm_bindgen::__rt::Start` is not satisfied
--> src/lib.rs:700:1
|
700 | #[wasm_bindgen(start)]
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `seed::prelude::wasm_bindgen::__rt::Start` is not implemented for `Box<[seed::prelude::JsValue]>`
|
= note: this error originates in the attribute macro `wasm_bindgen`
I'm hoping that I may be missing something but I believe wrapping wasm_bindgen in start is required as when I compile without it the package files contain errors. Being able to return closures appears to be the key piece when tying web_sys callbacks into the messaging system. Am I missing anything here?
The text was updated successfully, but these errors were encountered:
The
update_from_js
example shows how to create closures in rust and make them available in javascript:This works fine in the example, but our start function will generally use
#[wasm_bindgen(start)]
to make it immediately available to the application. The wasm-bindgen docs state that when using start, we can only return unit or a result: https://rustwasm.github.io/wasm-bindgen/reference/attributes/on-rust-exports/start.html.But the seed docs state (https://seed-rs.org/0.8.0/start):
When using the following in my seed application:
I get the following error:
I'm hoping that I may be missing something but I believe wrapping wasm_bindgen in
start
is required as when I compile without it the package files contain errors. Being able to return closures appears to be the key piece when tying web_sys callbacks into the messaging system. Am I missing anything here?The text was updated successfully, but these errors were encountered: