Yewもこの方法で仮想DOMを実装した模 様 use wasm_bindgen::prelude::*; use web_sys::{window, Document, HtmlElement}; #[wasm_bindgen(start)] pub fn run() -> Result<(), JsValue> { let window = window().expect("should have a Window"); let document = window.document().expect("should have a Document"); let div = document.create_element("div")?; div.set_inner_html("Hello from Rust!"); let body = document.body().expect("document should have a body"); body.append_child(&div as &dyn web_sys::Node)?; Ok(()) }