Open
Description
From chapter 4.6 Debugging
in the lib.rs file added:
#[macro_export]
macro_rules! log {
( $( &t:tt )* ) => {
web_sys::console::log_1(&format!( &( &t )* ).into());
}
}
log!("test data {}", 1);
then run wasm-pack build
it prints:
error: no rules expected the token `"test data {}"`
--> src/lib.rs:16:6
|
10 | macro_rules! log {
| ---------------- when calling this macro
...
16 | log!("test data {}", 1);
| ^^^^^^^^^^^^^^ no rules expected this token in macro call
|
= note: while trying to match sequence start
error: could not compile `wasm-game-of-life` (lib) due to previous error
could anyone give a correct code. thanks!!