I followed the slint WASM build instructions, but when I compile (wasm-pack build --release --target web) I get this error:
Compiling slint v1.0.1
Compiling tetris-slint v0.1.0 (/home/gaspard/Programmation/rust/tetris-slint)
error[E0277]: the trait bound `JsValue: From<PlatformError>` is not satisfied
--> src/main.rs:21:36
|
21 | #[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))]
| ^^^^^^^^^^^^^^^^^^^ the trait `From<PlatformError>` is not implemented for `JsValue`
|
= help: the following other types implement trait `From<T>`:
<JsValue as From<&'a String>>
<JsValue as From<&'a T>>
<JsValue as From<&'a str>>
<JsValue as From<*const T>>
<JsValue as From<*mut T>>
<JsValue as From<JsError>>
<JsValue as From<Option<T>>>
<JsValue as From<String>>
and 156 others
= note: required for `PlatformError` to implement `Into<JsValue>`
= note: required for `Result<(), PlatformError>` to implement `wasm_bindgen::__rt::Start`
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
Here is the repo containing all of the code
What am I missing?
The code and design looks great! Any plans to do a wasm version for online playing? Could use GitHub pages. (I can also try to help if that's interesting for you)
I think the easiest fix is to change the signature of main to be just fn main() and use .unwrap() instead of ? in the function calls that return a platform error.
I followed the slint WASM build instructions, but when I compile (
wasm-pack build --release --target web
) I get this error:Here is the repo containing all of the code What am I missing?
Originally posted by @tronical in https://github.com/slint-ui/slint/issues/2672#issuecomment-1529484130