The ssvmup tool

• One minute to read

Throughout our examples, we make extensive use of the ssvmup tool. It is inspired by the wasm-pack project but is optimized for server-side applications. Specifically, it supports the SSVM WebAssembly virtual machine and Deno host runtime.

The ssvmup uses wasm-bindgen to automatically generate the “glue” code between JavaScript and Rust source code so that they can communicate using their native data types. Without it, the function arguments and return values would be limited to very simple types (i.e., 32-bit integers) supported natively by WebAssembly. For example, strings or arrays would not be possible without ssvmup and wasm-bindgen.

Install

The easiest way to install ssvmup is through NPM.

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

You could also install ssvmup as a standalone tool for runtimes such as Deno. You need to have Rust installed before running the command below.

$ curl https://raw.githubusercontent.com/second-state/ssvmup/master/installer/init.sh -sSf | sh

Usage

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

$ ssvmup build

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

$ ssvmup build --target deno

Enjoy coding!

RustWebAssemblyNode.jsDenoJavaScriptrust-function-in-nodejs
Fast, safe, portable and serverless Rust functions as services