2

Managed to build and run some of the examples in https://github.com/rustwasm/wasm-bindgen/tree/master/examples

Then started with little prototype program for Dom manipulation, things works, until stuck on this.


Use https://docs.rs/web-sys/0.3.35/web_sys/struct.HtmlButtonElement.html

lists pub struct HtmlButtonElement, similar to

https://docs.rs/web-sys/0.3.35/web_sys/struct.Element.html and https://docs.rs/web-sys/0.3.35/web_sys/struct.HtmlElement.html

Having:

use web_sys::Element;
use web_sys::HtmlElement;
use web_sys::HtmlButtonElement;

Gives compile error:

error[E0432]: unresolved import `web_sys::HtmlButtonElement`
 --> src/lib.rs:8:5
  |
8 | use web_sys::HtmlButtonElement;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `HtmlButtonElement` in the root

While Element and HtmlElement are found in web_sys

What is the difference/missing for HtmlButtonElement? Does the no HtmlButtonElement in the root message give a clue?

Jonas Bojesen
  • 855
  • 1
  • 8
  • 22

1 Answers1

0

Following the comment by @chpio. When adding HtmlButtonElement to features in Cargo.toml HtmlButtonElement is found when building.

Jonas Bojesen
  • 855
  • 1
  • 8
  • 22