Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Latest commit

 

History

History

src-wasm

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CaBr2 WASM Library

This is the CaBr2 WASM library. It is written in Rust with wasm-bindgen.

In the src/impls folder is the glue code for the CaBr2 core logic.

Build

In order to build the WASM bindings you must first install rust and wasm-pack. You can install them via your package manager or from the links above. wasm-pack can also be installed via cargo after you installed Rust:

cargo install wasm-pack

The WASM binaries can be built in two flavours: an optimized version that is small or an debug version that can also display stack traces.

These two yarn commands are available:

# optimized version
yarn wasm_lib:release

# debug buid
yarn wasm_lib:debug

Normally you just have to run the yarn commands but if you want to build them manually these are the commands:

# optimized version
wasm-pack build --out-dir ../cabr2_wasm --release

# debug buid
wasm-pack build --out-dir ../cabr2_wasm --dev -- --features debug_build

Code Checking

We use clippy for linting and cargo fmt to check the formatting of the code:

cargo clippy --all-features -- --deny clippy::all
cargo fmt