Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.


Rust compiler toolkit for WebAssembly apps in the WasmEdge Runtime

npm npm GitHub language count GitHub top language

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.

$ curl --proto '=https' --tlsv1.2 -sSf | sh
$ source $HOME/.cargo/env


From Linux command line

$ curl -sSf | sh

From NPM and Node.js

$ npm install -g rustwasmc # Append --unsafe-perm if permission denied


To build Rust functions for Node.js applications, use the following command. See a template application. The rustwasmc compiles and generates the wasm file, and the corresponding JavaScript file to call wasm functions from JavaScript. If the rust package contains only binary crate(s) and there are no library crate, the build command will only generate a wasm-wasi file for running as a standalone command program in the WasmEdge VM.

$ rustwasmc build

In most cases, you will want to enable AOT optimization in order to improve performance.

$ rustwasmc build --enable-aot

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.

$ rustwasmc build --enable-aot --enable-ext

To build Rust functions for Deno applications, use the following command. See a template application.

$ rustwasmc build --target deno

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.

$ rustwasmc build --out-dir out

Use clean subcommand to remove pkg and target directories.

$ rustwasmc clean


rustwasmc uses env_logger to produce logs when rustwasmc runs.

To configure your log level, use the RUST_LOG environment variable. For example:

$ RUST_LOG=info rustwasmc build

Known issues

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.