Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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

https://github.com/alexcrichton/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

https://github.com/ashleygwilliams/wasm-pack

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

And more!

yew, an Elm-y framework

https://github.com/DenisKolodin/yew

stdweb, a batteries-included toolkit

https://github.com/koute/stdweb

rust-dominator, a virtual-dom

https://github.com/Pauan/rust-dominator

svelte, a code size profiler

https://github.com/fitzgen/svelte

wee_alloc, a tiny allocator

https://github.com/fitzgen/wee_alloc

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