wasm-game-of-life-euds63
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

wasm-game-of-life

About

a project to learn Rust

Usage

Clone this Template

git clone

Build with wasm-pack build

wasm-pack build

收获

  1. 自定义macro
    • 步骤
      1. 在一个模块中定义并导出自定义宏
        // utils.rs
        #[macro_export]
        macro_rules! log {
           ( $( $t:tt )* ) => {
              web_sys::console::log_1(&format!( $( $t )* ).into());
           }
        }
      2. 在其他模块中使用
        // lib.rs
        #[macro_use]
        mod utils;
        
        mod universe;
        
        // universe.rs
        use crate::utils;
        // 直接使用
        log!("This is a log message: {}", some_variable);
  2. Always let profiling guide your focus

踩坑

  1. npm install 失败
  1. wasm-build 失败
  1. wasm-pack test --chrome --headless 失败

待办

参考

Dependents (0)

Package Sidebar

Install

npm i wasm-game-of-life-euds63

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

58.1 kB

Total Files

6

Last publish

Collaborators

  • erica23187