README.md
August 26, 2021 ยท View on GitHub
wasm-calculator
Web Assembly Calculator POC wasm-pack.
About
This poc is designed for creating a Calculator app in Web Assembly and Rust
Requirements
Befor start with this poc You need to install Rust, Node
- First, complete the basic Rust setup instructions.
- Second, complete the Node installation Install Node.
๐ด Usage
๐ Use cargo generate to Clone this Template
Learn more about cargo generate here.
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name wasm-calculator
cd wasm-calculator
๐ ๏ธ Build with wasm-pack build
wasm-pack build
๐ฌ Test in Headless Browsers with wasm-pack test
wasm-pack test --headless --firefox
๐ Publish to NPM with wasm-pack publish
wasm-pack publish
๐ Batteries Included
wasm-bindgenfor communicating between WebAssembly and JavaScript.console_error_panic_hookfor logging panic messages to the developer console.wee_alloc, an allocator optimized for small code size.
Directory Structure
src/ under this dir we have lib.rs file where we write all functions required for calculator
test/ under this dir we write all test cases for all calculator operations
www/ under this folder we write javascript code (UI part of wasm-calculator)