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
RustでつくるWebアプリケーション(2)
Search
NearMeの技術発表資料です
PRO
January 20, 2023
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RustでつくるWebアプリケーション(2)
NearMeの技術発表資料です
PRO
January 20, 2023
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
0
9
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
1
32
初めてのLean言語
nearme_tech
PRO
0
63
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
1
19
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
56
SQL/ID抽出タスクから考える 実践的なハルシネーション対策
nearme_tech
PRO
1
65
OpenCode & Local LLM
nearme_tech
PRO
0
180
OpenCode Introduction
nearme_tech
PRO
0
55
【Browser Automation × AI】 Stagehandを試してみよう
nearme_tech
PRO
0
150
Other Decks in Programming
See All in Programming
dRuby over BLE
makicamel
2
400
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.6k
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
180
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
180
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
280
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
230
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.7k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
630
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
1k
1B+ /day規模のログを管理する技術
broadleaf
0
120
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
190
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.3k
Exploring anti-patterns in Rails
aemeredith
3
430
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Evolving SEO for Evolving Search Engines
ryanjones
0
230
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Optimizing for Happiness
mojombo
378
71k
Odyssey Design
rkendrick25
PRO
2
720
Building the Perfect Custom Keyboard
takai
2
810
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
210
Test your architecture with Archunit
thirion
1
2.3k
Transcript
0 RustでつくるWebアプリケーション(2) 2023-01-20 第29回NearMe技術勉強会 Asahi Kaito
1 今回は、RustとReactを用いたシングルページの アプリケーションを作成します!!
2 今後は、 (1) Reactの確認 (2) WebAssemblyについて (3) RustとReact ついてまとめます。
3 ですが、今回はその前段階として、 WebAssembly についてまとめます!!
4 WebAssembly(Wasm)について • Webブラウザで実行可能なバイナリ形式アセンブリライクな言語 → 字句解析と構文解析の大半を省くことができ、起動がより高速に • Webアプリケーションの高速化 → JavaScriptのような動的型付けの処理の一部をWasmに置きかえる
→ より高速な動作が期待される!! • Rust+Wasm → wasm-packを通してビルドできる
5 WebAssembly in Rust • JavaScriptの関数alertをRustで扱う → externを用いてalert関数を取り入れる #[wasm_bindgen] extern
{ pub fn alert(s: &str); }
6 WebAssembly in Rust • Rustで定義した関数をJavaScriptで扱う → #[wasm_bindgen]マクロを用いる #[wasm_bindgen] pub
fn greet(name: &str) { alert(&format!("Hello, {}", name)); } → 簡単にRustでWasmを利用できる!!
7 WebAssembly in Rust • JavaScriptでは... → greet関数とalert関数が以下のように扱われている /** *
@param {string} name */ export function greet(name) { const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.greet(ptr0, len0); } export function __wbg_alert_8755b7883b6ce0ef(arg0, arg1) { alert(getStringFromWasm0(arg0, arg1)); };
8 参考文献 • WebAssemblyとは (https://qiita.com/ShuntaShirai/items/3ac92412720789576f22) • WebAssembly Rust(https://www.rust-lang.org/ja/what/wasm) • WebAssembly
from MDN (https://developer.mozilla.org/ja/docs/WebAssembly)
9 Thank you