1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use wasm_bindgen::prelude::*; macro_rules! console_log { ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) } #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = console)] fn log(s: &str); } #[wasm_bindgen(start)] pub fn entry() { console_log!("hello {} wasm", 42); }