Plug WASM into Rust with wit-bindgen

  Рет қаралды 2,830

Michael Mullin

Michael Mullin

Күн бұрын

WASM only provides four types. Wasm-bindgen solves the problem of marshaling and unmarshaling of complex types for Rust to WASM to Javascript for Running WASM in a browser. But wasm-bindgen doesn't work for plugging WASM into Rust
Wit-bindgen to the rescue!
Wit-bindgen can be found here:
github.com/bytecodealliance/w...
My Example Code can be found here:
github.com/masmullin2000/wit-...
Image by: Clint Patterson
unsplash.com/@cbpsc1

Пікірлер: 11
@nicolassturm8853
@nicolassturm8853 Ай бұрын
nice video man, good to see zed editor implementing this for their plugins system right now 🔥
@thajafsal
@thajafsal Жыл бұрын
Thanks Michael
@dynamite-bud
@dynamite-bud 2 жыл бұрын
you inspired me Michael. Thank you
@aussieexpat
@aussieexpat 2 жыл бұрын
thanks for the presentation man. This area of x -> wasm ->x capability is very hard to follow right now. Was not even aware of fp-bindgen.
@uquantum
@uquantum Жыл бұрын
Thanks Michael: great overview, example code (unavoidably clunky🙂at this pre-alpha stage) and appreciate the concrete use cases. So while fp-bindgen is optimized for rust->wasm->rust, and wasm-bindgen does rust->wasm->JS, wit-bindgen has the greater ambition to provide any->wasm->any! Exciting update: there's now a wit-bindgen crate (v 0.0.0), very actively worked on.
@GlobalYoung7
@GlobalYoung7 2 жыл бұрын
Thank you 😊
@masmullin
@masmullin 2 жыл бұрын
You're welcome 😊
@jeffg4686
@jeffg4686 Жыл бұрын
This is cool. I was thinking of "plugin" model for wasm not long back. Like, allowing a programming like Blender / Bevy to have their plugins coded in any language (that can be compiled to wasm). Can you speak at all to the speed of marshalling as compared with something like the python embedded in blender. Crossing that barrier between the scripting and native always seems to be a lot of overhead (when crossing frequently - fine grained api), and I wonder if the same is true with WA or if it's not really any overhead at all (haven't finished video yet, so maybe discussed further - just something that popped to mind and thought I'd get down). One thing I can imagine is that authors of the application serving as the "plugin environment" might want to publish a portion of their API in WA ( a client API). Especially thinking in terms of minimizing the crossing of the barrier between host and hosted. So, the client api might be "building" data that all gets sent once built, but the building of it is all WA, and doesn't cross the host/hosted boundary. I just wanted to bring this up because the relationship between that client API and the "infrastructure" might be relevant in some way. I don't know all the possibilities, but thinking, for one, in terms of pre-loading client-api into the environment (not sure if that's really relevant or not). But, just think that side - client apis mostly in terms of making more coarse grained at the boundary level
@uoweme5grand
@uoweme5grand Жыл бұрын
I understand that the instantiate is part of the boilerplate code but is it possible to go over it somewhat. More specifically: - Why is it that we need to pass in closure to instantiate the modules? - Why does the context need to have a shape of { wasi, imports, exports }?
@aussieexpat
@aussieexpat 2 жыл бұрын
man... this soooo much less nice than running node -> rust using wasm-bindgen But I guess it's close to the best we've got for doing rust to rust or hopefully X to X eventually.
@TekExplorer
@TekExplorer Ай бұрын
this video is very quiet :(
Rust: Make a Cargo Plugin, It's EASY!!!
14:40
Michael Mullin
Рет қаралды 862
The Pattern You MUST Learn in .NET
20:48
Nick Chapsas
Рет қаралды 79 М.
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 129 МЛН
когда повзрослела // EVA mash
00:40
EVA mash
Рет қаралды 3,7 МЛН
The Performance overhead of WASM over Native Rust
30:57
Michael Mullin
Рет қаралды 15 М.
BPF With C
1:07:02
Michael Mullin
Рет қаралды 5 М.
Data Across the Wasm Boundary By Dan Phillips
34:54
Devoxx
Рет қаралды 713
Rust: The Dangers of Early Performance Optimization
36:22
Michael Mullin
Рет қаралды 6 М.
Rust Allocators and Memory Management
43:51
Michael Mullin
Рет қаралды 8 М.
Rust's lifetimes made easy
6:39
timClicks
Рет қаралды 9 М.
Mike Seddon - Rust Plugins with WASM
20:10
RustAU
Рет қаралды 1,4 М.
cute mini iphone
0:34
승비니 Seungbini
Рет қаралды 6 МЛН
Неразрушаемый смартфон
1:00
Status
Рет қаралды 2,3 МЛН
Спутниковый телефон #обзор #товары
0:35
Product show
Рет қаралды 1,9 МЛН