②Rust→Wasmにビルド ③HTML/JavaScriptを 記述 src / lib.rs #[wasm_bindgen] pub fn hello() -> String { "Hello Wasm!".to_string() } #[wasm_bindgen] は JavaScriptとRustをブリッジする ためのライブラリ $ wasm-pack build --target web pkg / *.wasm Wasmバイナリ本体 ブラウザが実行 *.js JavaScriptによる Wasmラッパー index.html Hello Wasm! import init, { hello } from "./pkg/hello_wasm.js"; Rustで書いた hello() 関数を 呼び出す Rust→WasmにコンパイルしHello Wasm!をしてみる … Copyright © 2026, Oracle and/or its affiliates 23 出力