Try it online: WebAssembly is here.
# RUSTFLAGS='-C link-arg=-s'
cd rsserve
cargo install
# cargo install --git https://github.com/wasmup/rsserve.git
# Finished release [optimized] target(s) in 5m 14s
file $(which rsserve)
go get -ldflags=-s -u github.com/shurcooL/goexec
goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`.`)))'
go get -ldflags=-s -u github.com/shurcooL/goexec
goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`.`)))'
echo $GOBIN
echo $GOPATH
cd ginserve
go get
go build -ldflags=-s -o $GOBIN/ginserve
which ginserve
file $(which ginserve)
./pyserve.py
Linux:
# Install Rust:
curl https://sh.rustup.rs -sSf | sh
# Then add some components:
rustup component add rustfmt rust-src rust-analysis rls
# Install targets for Rust
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
# https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md
curl https://wasmtime.dev/install.sh -sSf | bash
# https://github.com/WebAssembly/wabt
# curl -OL https://github.com/WebAssembly/wabt/archive/1.0.13.tar.gz
curl -OL https://github.com/WebAssembly/wabt/releases/download/1.0.13/wabt-1.0.13-linux.tar.gz
tar -C ~/ -xzvf ./wabt-1.0.13-linux.tar.gz
~/wabt-1.0.13/wasm2wat --version
# 1.0.13
# https://github.com/alexcrichton/wasm-gc
RUSTFLAGS='-C link-arg=-s' cargo install wasm-gc --force
# wasm-gc v0.1.6
file $(which wasm-gc)
wasm-gc -h
# https://github.com/rustwasm/wasm-bindgen
RUSTFLAGS='-C link-arg=-s' cargo install wasm-bindgen-cli --force
file $(which wasm-bindgen)
wasm-bindgen --version
# wasm-bindgen 0.2.58
WebAssembly is fast, safe, portable, and part of the open Web platform.
Using the advantage of strongly typed languages like Go, Rust, ... (compiler can detect many errors at compile time)
Portable target for compilation of high-level languages
Available on a wide range of platforms including mobile and IoT (not just x86)
Efficient and fast (near-native performance, precompiled: relative to JavaScript)
Size-efficient and load-time-efficient binary format
Memory-safe
Sandboxed execution environment
Non-web embeddings
Accessible from JavaScript, integrate well with the existing Web platform
Integrating with the Web ecosystem
Leveraging Web APIs
Supporting the Web’s security model
Preserving the Web’s portability
Designing in room for evolutionary development
See also:
Go WebAssembly
WebAssembly JavaScript Interface
Understanding the JS API
Roadmap
yew: Rust / Wasm framework for building client web apps
yew-wasm-pack-template: A template for starting a Yew project to be used with wasm-pack
wasm-bindgen: Facilitating high-level interactions between Wasm modules and JavaScript
wasm-bindgen docs
Standalone JIT-style runtime for WebAssembly
WASI tutorial
WASI: WebAssembly System Interface
WASI - The WebAssembly System Interface
WebAssembly Runtime supporting WASI
Design Rationale
WebAssembly High-Level Goals
webassembly.org
webassembly.studio
WebAssembly Specifications
WebAssembly Reference Manual
developer.mozilla
awesome-wasm
Rust and WebAssembly
Features to add after the MVP
GitHub
C to Webassembly
Notes on working with C and WebAssembly
WebAssembly lld port
WASM in Rust without NodeJS