|
| 1 | +--- |
| 2 | +title: "This Week in Rust and WebAssembly 10" |
| 3 | +--- |
| 4 | + |
| 5 | +Hello and welcome to another issue of *This Week in Rust and WebAssembly*! |
| 6 | + |
| 7 | +[Rust](https://rust-lang.org) is a systems language pursuing the trifecta: |
| 8 | +safety, concurrency, and speed. |
| 9 | + |
| 10 | +[WebAssembly](http://webassembly.org) is a stack-based virtual machine and |
| 11 | +instruction set. It is fast, safe, portable, and part of the open Web |
| 12 | +platform. By compiling to WebAssembly, we can run Rust code on the Web! |
| 13 | + |
| 14 | +This is a weekly summary of Rust and WebAssembly's progress and community. |
| 15 | + |
| 16 | +Did we miss something? Tweet to us at [@rustwasm](https://twitter.com/rustwasm) |
| 17 | +or [send us a pull request](https://github.com/rustwasm/rustwasm.github.io). |
| 18 | + |
| 19 | +## News and Blog Posts from Around the Web |
| 20 | + |
| 21 | +*Want to make sure something ends up on this list next time we publish an issue? |
| 22 | +[Leave a comment on this issue.](https://github.com/rustwasm/team/issues/79)* |
| 23 | + |
| 24 | +* [**Reflecting on Rust and WebAssembly in |
| 25 | + 2018**](https://rustwasm.github.io/2018/12/06/reflecting-on-rust-and-wasm-in-2018.html) |
| 26 | + |
| 27 | +* [`wasm-bindgen` — how does it |
| 28 | + work?!](http://fitzgeraldnick.com/2018/12/02/wasm-bindgen-how-does-it-work.html) |
| 29 | + |
| 30 | +* [Edge programming with Rust and WebAssembly with |
| 31 | + Terrarium](https://www.fastly.com/blog/edge-programming-rust-web-assembly) |
| 32 | + |
| 33 | +* [Embedding WebAssembly in your Rust Application with |
| 34 | + wasmer.io](https://medium.com/wasmer/executing-webassembly-in-your-rust-application-d5cd32e8ce46) |
| 35 | + |
| 36 | +* [The `console_log` crate](https://github.com/iamcodemaker/console_log) is a |
| 37 | + backend for [the `log` facade](https://crates.io/crates/log) that pipes logged |
| 38 | + messages to the browser's console. |
| 39 | + |
| 40 | +* [Zemeroth](https://ozkriff.itch.io/zemeroth) is a turn-based hexagonal |
| 41 | + tactical game written in Rust and WebAssembly. |
| 42 | + |
| 43 | +* [An example implementation of react/redux style UI development in Rust with |
| 44 | + `percy`](https://github.com/richardanaya/virtual-dom-rs-counter) |
| 45 | + |
| 46 | +* [Seed](https://github.com/David-OConnor/seed) is a new Wasm framework for Web |
| 47 | + apps. |
| 48 | + |
| 49 | +* [`sendilkumarn/generator-wasm-app`](https://github.com/sendilkumarn/generator-wasm-app) |
| 50 | + is a a Wasm app generator for [Yeoman](https://yeoman.io/). |
| 51 | + |
| 52 | +* [`edvorg/rustsmith`](https://github.com/edvorg/rustmith) is a Rocksmith clone |
| 53 | + for the Web platform built with Rust and WebAssembly. |
| 54 | + |
| 55 | +### `#RustWasm2019` Posts |
| 56 | + |
| 57 | +* [Rust WebAssembly 2019](https://blog.ryanlevick.com/posts/rust-wasm-2019/) by |
| 58 | + Ryan Levick |
| 59 | + |
| 60 | +* [My Rust 2019 Dream: Dominate the |
| 61 | + Web](https://www.reddit.com/r/rust/comments/aac8zk/my_rust_2019_dream_dominate_the_web/) |
| 62 | + by richardanaya |
| 63 | + |
| 64 | +* [Wasm 2019](https://blog.yoshuawuyts.com/wasm-2019/) by Yoshua Wuyts |
| 65 | + |
| 66 | +* [Rust and WebAssembly in |
| 67 | + 2019](http://fitzgeraldnick.com/2018/12/14/rust-and-webassembly-in-2019.html) |
| 68 | + by Nick Fitzgerald |
| 69 | + |
| 70 | +* [Non-Web Embeddings for Rust Wasm |
| 71 | + 2019](https://medium.com/wasmer/non-web-embeddings-for-rust-wasm-2019-7b290e94f81d) |
| 72 | + by Brandon Fish and wasmer.io |
| 73 | + |
| 74 | +## Wasm at the 2019 Rust All Hands |
| 75 | + |
| 76 | +The 2019 Rust All Hands meetup was in Berlin on February 4<sup>th</sup> through |
| 77 | +8<sup>th</sup>. @ag_dubs, @alexcrichton, @fitzgen, and @yoshuawuyts from the |
| 78 | +Rust and WebAssembly working group all made it out to discuss some Wasm-related |
| 79 | +topics and plan for 2019. |
| 80 | + |
| 81 | +We talked about: |
| 82 | + |
| 83 | +* [The road to `wasm-pack` |
| 84 | + 1.0.](https://gist.github.com/fitzgen/23a62ebbd67574b9f6f72e5ac8eaeb67#file-road-to-wasm-pack-1-0-md) |
| 85 | + This meeting was about trying to pin down what we want to ship as part of a |
| 86 | + `wasm-pack` 1.0 release, as well as crystallize `wasm-pack`'s ideal UX. |
| 87 | + |
| 88 | +* [A modular toolkit for |
| 89 | + Wasm.](https://gist.github.com/fitzgen/23a62ebbd67574b9f6f72e5ac8eaeb67#file-modular-toolkit-md) |
| 90 | + There's been a lot of talk in `#RustWasm2019` posts and the 2019 roadmap RFC |
| 91 | + about building a modular toolkit for Wasm apps and libraries. This meeting was |
| 92 | + trying to dig a bit more into the details of what that entails. And naming, of |
| 93 | + course. |
| 94 | + |
| 95 | +* [`cargo` build tasks, hooks, and/or `post-build.rs` for |
| 96 | + Wasm.](https://gist.github.com/fitzgen/23a62ebbd67574b9f6f72e5ac8eaeb67#file-cargo-build-hooks-for-wasm-md) |
| 97 | + Long-term (likely on the timeline of a couple years) we would like the |
| 98 | + experience of building Rust and Wasm projects to be *exactly* the same as |
| 99 | + building normal Rust projects: just `cargo build` and that's it. But there is |
| 100 | + a bunch of stuff that needs to happen for Wasm after `rustc` emits a Wasm |
| 101 | + binary, such as generate JS bindings or run `wasm-opt`. This meeting was about |
| 102 | + how to add some sort of generic build hooks to `cargo` and turn `wasm-pack` |
| 103 | + into an implementation of those generic hooks specifically targeted for Wasm |
| 104 | + development. |
| 105 | + |
| 106 | +* [Multithreading Wasm and |
| 107 | + `rayon`.](https://gist.github.com/fitzgen/23a62ebbd67574b9f6f72e5ac8eaeb67#file-wasm-multithreading-and-rayon-md) |
| 108 | + This meeting was about how we take our experimental Wasm multithreading |
| 109 | + support and turn it into a reliable library that can serve as the foundation |
| 110 | + for multithreading on the Web. @CUViper from the `rayon` team also joined, and |
| 111 | + we made a plan for how to get `rayon` working in Wasm. |
| 112 | + |
| 113 | +## Updates from [`rustwasm/*`](https://github.com/rustwasm) |
| 114 | + |
| 115 | +### RFCs |
| 116 | + |
| 117 | +#### New RFCs |
| 118 | + |
| 119 | +* [**2019 Roadmap**](https://github.com/rustwasm/rfcs/pull/7) — this is |
| 120 | + your chance to help shape our goals for the year! |
| 121 | + |
| 122 | +* [Add support for local JS snippets in `wasm-bindgen`](https://github.com/rustwasm/rfcs/pull/6) |
| 123 | + |
| 124 | +#### Merged RFCs |
| 125 | + |
| 126 | +None. |
| 127 | + |
| 128 | +### Book |
| 129 | + |
| 130 | +* @DebugSteven [wrote a testing |
| 131 | + section](https://github.com/rustwasm/book/pull/137) for the Game of Life |
| 132 | + tutorial! |
| 133 | + |
| 134 | +### Twiggy🌱 |
| 135 | + |
| 136 | +* [**We released Twiggy🌱 0.4.0! |
| 137 | + 🎉**](https://github.com/rustwasm/twiggy/blob/master/CHANGELOG.md#040) |
| 138 | + |
| 139 | +* @brson fixed a bug where we would [attempt to demangle things that were not |
| 140 | + C++](https://github.com/rustwasm/twiggy/pull/232) symbols as if they were C++ |
| 141 | + symbols. |
| 142 | + |
| 143 | +### `walrus` |
| 144 | + |
| 145 | +* [`walrus` is a new library crate for writing Wasm-to-Wasm |
| 146 | + transformations.](https://github.com/rustwasm/walrus) It will eventually (but |
| 147 | + doesn't yet) preserve DWARF debug info for the Wasm across your |
| 148 | + transformations. |
| 149 | + |
| 150 | +* @alexcrichton got `walrus` [round-tripping all the Wasm spec |
| 151 | + tests](https://github.com/rustwasm/walrus/pull/24) correctly. |
| 152 | + |
| 153 | +* @fitzgen [wrote a simple Wasm |
| 154 | + fuzzer](https://github.com/rustwasm/walrus/pull/45), immediately found a bug, |
| 155 | + and whipped up a fix. |
| 156 | + |
| 157 | +* @alexcrichton refactored instruction parsing to [avoid |
| 158 | + recursion](https://github.com/rustwasm/walrus/pull/48). This means that we |
| 159 | + don't blow the stack in debug builds or when given malicious input. |
| 160 | + |
| 161 | +* We just released `walrus` 0.1.0 on crates.io — expect more exciting |
| 162 | + things from `walrus` in the future :) |
| 163 | + |
| 164 | +### `wasm-bindgen` |
| 165 | + |
| 166 | +* [**We released `wasm-bindgen` 0.2.29 through 0.2.36! |
| 167 | + 🎉**](https://github.com/rustwasm/wasm-bindgen/blob/master/CHANGELOG.md#0236) |
| 168 | + |
| 169 | +* @derekdreery [improved the `std::fmt::Debug` output for |
| 170 | + `JsValue`](https://github.com/rustwasm/wasm-bindgen/pull/1161) so that it |
| 171 | + includes object properties and their values, instead of just `[object |
| 172 | + Object]`. |
| 173 | + |
| 174 | +* @fitzgen made the `wasm-bindgen-test` testing infrastructure [capture more |
| 175 | + `console` logging methods' (`warn`, `info`, etc) |
| 176 | + output](https://github.com/rustwasm/wasm-bindgen/pull/1184) for displaying in |
| 177 | + `stdout`. |
| 178 | + |
| 179 | +* @T5uku5hi [added `#[allow(clippy::all)]` to `wasm-bindgen`'s macro-generated |
| 180 | + code,](https://github.com/rustwasm/wasm-bindgen/pull/1207) so that running |
| 181 | + clippy on crates that use `wasm-bindgen` isn't so noisy. |
| 182 | + |
| 183 | +* @alexcrichton added support for [passing `Option<MyEnum>` back and |
| 184 | + forth](https://github.com/rustwasm/wasm-bindgen/pull/1214) between Wasm and JS |
| 185 | + if `MyEnum` has the `#[wasm_bindgen]` attribute. |
| 186 | + |
| 187 | +* @fitzgen [added the `UnwrapThrowExt` |
| 188 | + trait](https://github.com/rustwasm/wasm-bindgen/pull/1219) to `wasm-bindgen`'s |
| 189 | + prelude. This extension trait adds `unwrap_throw` and `expect_throw` methods |
| 190 | + to `Option<T>` and `Result<T, E>` that have the same behavior as regular |
| 191 | + `unwrap` and `expect` except they throw a JS error on failure instead of |
| 192 | + panicking. This is morally the same, but ends up avoiding the `std::panicking` |
| 193 | + and `std::fmt` infrastructure, resulting in smaller code sizes. |
| 194 | + |
| 195 | +* @alexcrichton [migrated `wasm-bindgen`'s post-`rustc` Wasm |
| 196 | + transformations](https://github.com/rustwasm/wasm-bindgen/pull/1237) to the |
| 197 | + new `walrus` crate! This paves the way for maintaining DWARF debug info |
| 198 | + through `wasm-bindgen`. |
| 199 | + |
| 200 | +* @fitzgen made the `wasm-bindgen-test` runtime capture logged messages in tests |
| 201 | + [via `textContent` instead of |
| 202 | + `innerHTML`](https://github.com/rustwasm/wasm-bindgen/pull/1233), avoiding |
| 203 | + issues when logging HTML strings ;) |
| 204 | + |
| 205 | +### `wasm-pack` |
| 206 | + |
| 207 | +* [**We released `wasm-pack` |
| 208 | + 0.6.0! 🎉**](https://github.com/rustwasm/wasm-pack/blob/master/CHANGELOG.md#-060) |
| 209 | + |
| 210 | +* @drager implemented [support for typo |
| 211 | + detection](https://github.com/rustwasm/wasm-pack/pull/446) in `wasm-pack`'s |
| 212 | + `Cargo.toml` section. |
| 213 | + |
| 214 | +* @torkve added support for [passing arbitrary extra CLI arguments through |
| 215 | + `wasm-pack build`](https://github.com/rustwasm/wasm-pack/pull/461) and into |
| 216 | + `cargo build`. For example, to build with all cargo features enabled: |
| 217 | + `wasm-pack build -- --all-features`. |
| 218 | + |
| 219 | +* This inspired @chinedufn to add support for [passing arbitrary extra CLI arguments |
| 220 | + through `wasm-pack test`](https://github.com/rustwasm/wasm-pack/pull/530) and |
| 221 | + into `cargo test`! |
| 222 | + |
| 223 | +* @fitzgen fixed a bug where [the output of `wasm-pack test` was printed |
| 224 | + twice](https://github.com/rustwasm/wasm-pack/pull/521). |
| 225 | + |
| 226 | +* @rhysd added support for [emitting the "homepage" |
| 227 | + field](https://github.com/rustwasm/wasm-pack/pull/531) in our generated |
| 228 | + `package.json` if it is present in the crate's `Cargo.toml`. |
| 229 | + |
| 230 | +* @jscheffner [fixed `wasm-pack`'s fetching of `chromedriver` |
| 231 | + binaries](https://github.com/rustwasm/wasm-pack/pull/537) for headless browser |
| 232 | + testing on Windows. |
| 233 | + |
| 234 | +## Requests for Contribution |
| 235 | + |
| 236 | +*Want to get involved in Rust and WebAssembly? [Join the Rust and WebAssembly |
| 237 | +working group!][get-involved]* |
| 238 | + |
| 239 | +* [All issues labeled "good first issue" in the `rustwasm/*` repositories](https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Arustwasm+archived%3Afalse+label%3A%22good+first+issue%22) |
| 240 | + |
| 241 | +* [All issues labeled "help wanted" in the `rustwasm/*` repositories](https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Arustwasm+archived%3Afalse+label%3A%22help+wanted%22) |
| 242 | + |
| 243 | +### New "Help Wanted" Issues |
| 244 | + |
| 245 | +* [`wasm-pack` — docs: add documentation for working with wasm-pack |
| 246 | + outside of template](https://github.com/rustwasm/wasm-pack/issues/533) |
| 247 | + |
| 248 | +* [`wasm-pack` — installer: do not attempt to install to |
| 249 | + /usr/bin](https://github.com/rustwasm/wasm-pack/issues/470) |
| 250 | + |
| 251 | +[get-involved]: https://github.com/rustwasm/team/blob/master/README.md#get-involved |
0 commit comments