Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
wstdなんだか良さそう
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
asuka
June 17, 2025
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
wstdなんだか良さそう
UV Study : Rust LT会 ~お好きなCrate紹介してください~
https://uniquevision.connpass.com/event/355069/
asuka
June 17, 2025
More Decks by asuka
See All by asuka
GoとSIMDとWasmの今。
askua
3
590
2025年ふりかえり
askua
1
250
ライブラリを公開してメンテナンスした一年
askua
0
110
Wasmの気になる最新情報
askua
1
400
Wasmのエコシステムを使った ツール作成方法
askua
0
430
Pure Goで体験するWasmの未来
askua
1
1.1k
Wasmで社内ツールを作って配布しよう
askua
0
330
Wasm元年
askua
0
390
Dartでウェブ開発 (やりたい)
askua
0
110
Other Decks in Technology
See All in Technology
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
My broken English still works: speaking at global OSS events
naruoga
0
120
猫付きpingコマンドを自作
uyuki234
0
290
【GCC2026】大規模言語モデルを活用した内製検索サービスの社内展開や業務活用
bandainamcostudios
PRO
0
390
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
20k
Adding Right-to-Left support to your web application with CSS logical properties — Lessons from Redmine
vividtone
0
160
LanceDB入門
mocobeta
9
660
Digitization部 紹介資料
sansan33
PRO
2
7.7k
Oracle MCP Servers Explained
thatjeffsmith
0
340
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
140
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
8bit CPU 2026
koba789
5
2.2k
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
360
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
930
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
250
Building AI with AI
inesmontani
PRO
1
1.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Prompt Engineering for Job Search
mfonobong
0
410
Code Reviewing Like a Champion
maltzj
528
40k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
660
Evolving SEO for Evolving Search Engines
ryanjones
0
260
Between Models and Reality
mayunak
4
400
Transcript
wstdなんか良さそう UV Study : Rust LT会 June 17, 2025
WHOAMI asuka • 株式会社モニクル/SWE ◦ Monicle Techbook vol.1 技術書典17 •
Wasm関連の同人誌・商業誌の執筆 ◦ 実践入門WebAssembly ◦ WebAssembly System Interface入門 ◦ ご注文はWASIですか?? 技術書典16 ◦ Wasm Cookbook vol.2 技術書典17 ◦ Wasm Cookbook vol.3 技術書典18 ◦ Wasm Cookbook vol.4 技術書典NT • 新宿御苑.dev ◦ 新宿御苑.wasm #2025.6.25 LT会 2 商業誌 Cookbookシリーズ ごちWASI
前提知識 3
前提知識 4 • WASI 0.2というWasmのシステムインターフェースの仕様が存在する • WASI 0.2はWIT(Wasm Interface Type)でインターフェースが定義されている
• RustはWASI 0.2をサポートしている Wasmの詳しい話は こういう本を読むと良い
前提知識 5 • WASI 0.2というWasmのシステムインターフェースの仕様が存在する • WASI 0.2はWIT(Wasm Interface Type)でインターフェースが定義されている
• RustはWASI 0.2をサポートしている Wasmの詳しい話は こういう本を読むと良い
RustはWASI 0.2をサポートしている cargo build -r –-target wasm32-wasip2 6 $ wasmtime
run <TARGET_PATH>/hello-world.wasm Hello, WASI 0.2! ターゲットにWASIp2 (WASI 0.2)を指定すると 「wasi:cli/command」ワールドが実装される
wasi:cli/commandワールド CLI実行に必要なFSなどの一般的なインターフェース実装 7 $ wasm-tools component wit <TARGET_PATH>/hello-world.wasm | head
package root:component; world root { import wasi:cli/
[email protected]
; import wasi:cli/
[email protected]
; import wasi:io/
[email protected]
; import wasi:io/
[email protected]
; import wasi:cli/
[email protected]
; import wasi:cli/
[email protected]
; import wasi:cli/
[email protected]
; import wasi:clocks/
[email protected]
; import wasi:filesystem/
[email protected]
; import wasi:filesystem/
[email protected]
; export wasi:cli/
[email protected]
; } https://wa.dev/wasi:cli
wasi:cli/commandワールド CLI実行に必要なFSなどの一般的なインターフェース実装 → ネットワーク関連のインターフェース定義は含まれていない 8 wasi:httpやwasi:socketといったパッケージ定義はあるが, ビルドターゲットとなる wasi:cli/commandには含まれていない WASIのインターフェース 使いたいなー
wasi:cli/commandに含まれていない WASIインターフェースを使うには 9
WASIインターフェースを使うには 10 1. WITを使ってインターフェースを定義 & 実装する a. wit-bindgen 2. WASIのインターフェースをラップしたクレートを使う
a. wasmcloud → 今回説明しない b. wstd
WITを使ってインターフェースを定義 & 実装する wit-bindgenを使う 11 インターフェースの定義 インターフェースの実装
WITを使ってインターフェースを定義 & 実装する wit-bindgenを使う 12 wasi:http/proxyを実装してみると... WITのインターフェース定義を そのまま使うのは少々面倒
WASIのインターフェースを もう少し簡単に扱いたい 13
WASIのインターフェースをラップした クレートを使おう 14
wstd 15
wstd 16 https://github.com/yoshuawuyts/wstd An async standard library for Wasm Components
and WASI 0.2 $ wasmtime run -S http <TARGET_PATH>/example.wasm <!doctype html> <html> <head> <title>Example Domain</title> ... 実行できる
wstd 1. 非同期をサポートしている 2. WASIの薄いラッパーである 17 #[wstd::main] WASI 0.2には非同期インターフェースがない (WASI
0.3で導入予定) pollingインターフェースをラップして Futureとして扱えるように
wstd 1. 非同期をサポートしている 2. WASIの薄いラッパーである 18 WASIとの対応がわかりやすい
wstd 1. 非同期をサポートしている 2. WASIの薄いラッパーである 19 Request::get(“https::example.com”).body(io::empty())?; WITの定義をそのまま使うともっと冗長になる
wstd 20 WASIのインターフェースを 使いたい時に良さそう