rust-multi-demo
A Rust demo project for multiple targets.
There are 4 sub projects:
- demo-lib: The main functions.
- demo: The CLI binary wrapper.
- demo-py: The Python interface wrapper.
- demo-wasm: The web interface wrapper, for JS or TS.
Library
cargo build
# or
cargo build -p demo-lib
Binary
cargo run
# or
cargo run -p demo
PyPI
maturin build -m src/demo-py/Cargo.toml
Run pipx install maturin
first if it is not installed.
The wheel is built to target/wheels/
.
NPM
wasm-pack build src/demo-wasm --target=web
Run cargo install wasm-pack
first if it is not installed.
The target files are built to src/demo-wasm/pkg/
.
There is a index.html
here for preview.
python3 -m http.server --directory src/demo-wasm/