Rust compiler toolkit for WebAssembly apps in the WasmEdge Runtime
Developers: Getting started with the Second State Functions (a serverless FaaS service), Tencent Serverless Functions for AI inference, or your own Node.js server.
A one-stop tool for building Rust functions into WebAssembly for deployment on the WasmEdge Runtime.
You will need to install the Rust compiler in order to use
rustwasmc. Currently, we support up to Rust 1.50.0.
From Linux command line
From NPM and Node.js
To build Rust functions for Node.js applications, use the following command. See a template application. The
wasm-wasi file for running as a standalone command program in the WasmEdge VM.
In most cases, you will want to enable AOT optimization in order to improve performance.
If you would like to use WasmEdge's extended APIs including Tensorflow, enable the extensions. Make sure that you install the
wasmedge-extensions NPM module in this case.
To build Rust functions for Deno applications, use the following command. See a template application.
By default, rustwasmc will generate a directory for it's build output called pkg. If you'd like to customize this you can use the --out-dir flag.
Use clean subcommand to remove pkg and target directories.
env_logger to produce logs when
To configure your log level, use the
RUST_LOG environment variable. For example:
For Rust version 1.51 and above,
rustwasmc generates bytecode without WASI support. That means programs that access the file system, date and time, environment variables, and command line arguments would fail on Rust 1.50+. This should not affect most application use cases. We are working on a solution.
This project is derived from the open source wasm-pack.