iced-rs / iced_web

A web runtime for iced that targets the DOM
93 stars 4 forks source link

[Question] Error building `clock` example over the web runtime #12

Open xiaoyu2006 opened 2 years ago

xiaoyu2006 commented 2 years ago

I have copied&pasted the clock example into a binary crate with the following Cargo manifest.

[package]
name = "clock"
version = "0.1.0"
edition = "2021"

[dependencies]
iced = { git = "https://github.com/iced-rs/iced.git", features = ["canvas", "tokio", "debug"] }
iced_web = { git = "https://github.com/iced-rs/iced.git" }
chrono = "0.4"

I built with cargo build --bin clock --target wasm32-unknown-unknown following the guide. However the compiler gave an error:

error[E0432]: unresolved imports `iced::canvas`, `iced::canvas`, `iced::time`
 --> clock/src/main.rs:3:5
  |
3 |     canvas::{self, Cache, Canvas, Cursor, Geometry, LineCap, Path, Stroke},
  |     ^^^^^^   ^^^^ no `canvas` in the root
  |     |
  |     could not find `canvas` in `iced`
4 |     executor, time, Application, Color, Command, Container, Element, Length,
  |               ^^^^ no `time` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `clock` due to previous error

Am I doing something wrong? Or is canvas not supported over wasm yet?

hecrj commented 2 years ago

Or is canvas not supported over wasm yet?

That is correct. Canvas is not supported on Wasm yet!