Skip to content

Instantly share code, notes, and snippets.

@fitzgen
Created March 29, 2018 09:08
Show Gist options
  • Save fitzgen/700e134cffe9a8438524f0a39810a4d0 to your computer and use it in GitHub Desktop.
Save fitzgen/700e134cffe9a8438524f0a39810a4d0 to your computer and use it in GitHub Desktop.

WG: Rust + Wasm = 💖

I’m fitzgen (Nick Fitzgerald)

Feel free to ask questions

irc://irc.mozilla.org#rust-wasm

github.com/rust-lang-nursery/rust-wasm

What is WebAssembly?

Simple machine model w/ linear memory

Executable format

Extensive specification

Near native speed

“Rust is a chance to get things right”

But we need to ship

We need to make it usable

We need to document it

We need to explain it

“WebAssembly is a chance to get things right”

But we need to ship

We need to make it usable

We need to document it

We need to explain it

What does our WG want to accomplish?

Compiling Rust to WebAssembly should be the best choice for fast code on the Web

Rust plays well with others

In this case, JavaScript

See the Rust + Wasm in the `source-map` library

Tons of potential impact, adoption, new users, etc

Universal Binaries

Sandboxed, safe

Smart contracts

Rust is particularly well-suited for Wasm

Freedom from GC and no runtime

Small `.wasm` binaries

Incremental adoption

Current Status?

wasm-bindgen

Bidirectional interop w/ JS

Import JS classes with `extern type`

Import JS functions with `extern fn`

Export structs and their methods as JS classes

Export functions as JS functions w/ arguments marshalling

Pay only for what you use

wasm-pack

“pack up the wasm and publish it to npm!”

And more!

yew, an Elm-y framework

stdweb, a batteries-included toolkit

rust-dominator, a virtual-dom

svelte, a code size profiler

wee_alloc, a tiny allocator

For * Rust 2018 Edition *

Smooth and “stable” wasm32-unknown-unknown experience

Rust + Wasm book w/ tutorials

Tooling and library ecosystem

Integrating with Web bundlers

Polish, polish, polish!

How to get polish?

Outreach to maintainers of popular JS libraries

Dog fooding

Weekly Rust + Wasm code challenges?

TypeScript -> wasm-bindgen

More correct than WebIDL

Compile into wasm-bindgen externs

Access not only whole Web platform, but npm too

Foundation for Web “system calls”

What we need from other Rust folks

Panicking without code bloat!!!11!!!1!!

Procedural macros (wasm-bindgen)

Custom allocators

Custom test frameworks

cargo templates

Overlapping requests with WG-embedded!

Thanks!

Questions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment