Non-Web Embeddings for Rust Wasm 2019

Brandon Fish
Wasmer
Published in
2 min readJan 15, 2019

The Rust Wasm team has made tremendous progress in building robust developer tooling for Rust targeting WebAssembly on the Web in 2018. However, Non-Web Embeddings are also supported by WebAssembly but have not received much attention yet for Rust Wasm tooling. Our wish for Rust Wasm 2019 is to improve the tooling for Non-Web Wasm Embeddings which we believe also has enormous potential.

There are already many projects exploring the potential of Non-Web Wasm Embeddings:

  • Blockchain – Parity, NEAR Protocol
  • Edge Compute – Wasm Fastly Labs, Wasm Cloudflare Wokers
  • Embedded Devices
  • Server-side Development — Wasmer
  • Embedded Scripting (Games, Web Applications, and other sandboxed environments)
  • Serverless/Functions as a Service
  • Polyglot Programming
  • Cross-Platform Applications
  • Batch and Stream Data Processing

It is currently difficult to create useful host APIs with the limited types available in Wasm imports. Using this minimal API usually results in a lot of boilerplate code which is not reusable across multiple languages.
If we could use the ergonomics of wasm bindgen for Non-Web use cases, it would be very helpful in the development of reusable APIs for Wasm runtimes.

Our Wish List for Rust Wasm 2019

  • A stable set of imports for host bindings to target in wasm-bingen. It would be helpful to be able to configure which module name should be used for host provided imports and prefer non-mangled names if possible. For example, the Emscripten imports for Wasm are relatively stable which makes it easier to support Emscripten style Wasm. Even though the Emscripten API is reasonably stable, it would be better to design a new host API specifically for WASM.
  • Consider C, C++, and other source languages to enable common host APIs and language interoperability. The wasm-bindgen guide mentions the idea of future C/C++ integration and we hope this possibility is explored.
  • Participation of Rust Wasm in the development of a common base API, e.g reference-sysroot.

Rust Wasm has excellent support for web and it is our hope the same tooling can adapt to support Non-Web Wasm use cases in 2019.

We believe WebAssembly will be a key technology in the future. Because of that, we are working on a new Rust based Wasm runtime called Wasmer, so you can run WebAssembly anywhere you want.

With Wasmer, you can run WebAssembly anywhere you want, outside browser environments.

Follow the project on Github, and comment where you would like us to go moving forward!

--

--