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 Front-end with Yew
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ciro Nunes
September 14, 2022
Programming
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rust Front-end with Yew
Ciro Nunes
September 14, 2022
More Decks by Ciro Nunes
See All by Ciro Nunes
Type safe CSS with Reason
cironunes
0
150
What I've learned building automated docs for Ansarada's design system
cironunes
0
99
Beyond ng new
cironunes
2
240
Animate your Angular apps
cironunes
0
460
Sweet Angular, good forms never felt so good
cironunes
0
100
Sweet Angular, good forms never felt so good
cironunes
0
320
Progressive Angular apps
cironunes
3
950
Angular: Um framework. Mobile & desktop.
cironunes
1
610
Firebase & Angular
cironunes
0
300
Other Decks in Programming
See All in Programming
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
590
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.4k
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
190
自作OSでスライド発表する
uyuki234
1
3.8k
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
1
480
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
130
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
190
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
160
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
140
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
220
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
A Modern Web Designer's Workflow
chriscoyier
698
190k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
220
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
How to train your dragon (web standard)
notwaldorf
97
6.7k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
460
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
340
The Invisible Side of Design
smashingmag
301
52k
Transcript
Ciro Nunes 14 Sep 22 Rust Front-end with Yew 🦀🇦🇺
Agenda ⁉ What is Yew? Why Wasm & Rust? 🪄
Simple tutorial 🤩 My impressions 🗺 Where to go from here
What is Yew? Why Wasm & 🦀?
What is Yew?
Yew Rust / Wasm client web app framework
Yew Multi-threaded front-end web apps using WebAssembly 🏎💨
Yew Multi-threaded front-end web apps using WebAssembly 🏎💨 • Component-based
Yew Multi-threaded front-end web apps using WebAssembly 🏎💨 • Component-based
• Great performance
Yew Multi-threaded front-end web apps using WebAssembly 🏎💨 • Component-based
• Great performance • JavaScript interoperability
Why Wasm?
WebAssembly Low-level assembly-like language with a compact binary format that
runs with near-native performance and provides languages like Rust with a compilation target that can run in modern web browsers.
WebAssembly Not a silver bullet for improving performance of web
apps 🤪
WebAssembly Not a silver bullet for improving performance of web
apps 🤪 • DOM APIs from Wasm are still slower than directly from JS
WebAssembly Not a silver bullet for improving performance of web
apps 🤪 • DOM APIs from Wasm are still slower than directly from JS • Perfect for heavy computation applications
WebAssembly Not a silver bullet for improving performance of web
apps 🤪 • DOM APIs from Wasm are still slower than directly from JS • Perfect for heavy computation applications • Multi-threading via Web Workers
Why Rust?
Rust Helps developers write safer code with its rich type
system and ownership model
Simple tutorial
Let’s build a To-do app
None
None
# [ derive(Clone)] struct Todo { text: String, completed: bool,
}
struct TodoComponent { todos: Vec<Todo>, new_todo_txt: String, }
enum Msg { AddTodo, UpdateNewTodo(String), }
impl Component for TodoComponent { type Message = Msg; type
Properties = (); fn create(_ctx: &Context<Self>) - > Self {} fn update(&mut self,_ctx, msg: Self : : Message) - > bool {} fn view(&self, ctx: &Context<Self>) - > Html {} }
fn create(_ctx: &Context<Self>) - > Self { Self { todos:
vec![Todo { text: "Learn Rust".to_string(), completed: true, }], new_todo_txt: "".to_string(), } }
fn view(&self, ctx: &Context<Self>) - > Html { let link
= ctx.link(); let on_cautious_change = link.batch_callback(|e: Event| { let input = e.target_dyn_into: : < HtmlInputElement>(); input.map(|input| Msg : : UpdateNewTodo(input.value())) }); html! { <div> <ol> { self.todos.iter().map(|todo| html! { <li> <input type="checkbox" checked={todo.completed} / > <span>{format!("{}", todo.text)} < / span> < / li> }).collect: : < Html>()} < / ol> <div> <input type="text" value={self.new_todo_txt.to_string()} onchange={on_cautious_change} / > <button onclick={link.callback(|_| Msg : : AddTodo)}>{ "Add" } < / button> < / div> < / div> } }
fn update(&mut self, _ctx: &Context<Self>, msg: Self : : Message)
- > bool { match msg { Msg : : AddTodo = > { let new_todo = Todo { text: self.new_todo_txt.to_string(), completed: false, }; self.new_todo_txt = "".to_string(); self.todos.push(new_todo); true } Msg : : UpdateNewTodo(new_txt) = > { self.new_todo_txt = new_txt; true } } }
use yew : : prelude : : *; fn main()
{ yew : : start_app: : < TodoComponent>(); }
My impressions
My impressions Yew
My impressions Yew • Very similar to React, but it’s
Rust
My impressions Yew • Very similar to React, but it’s
Rust • Easy to setup and learn the basics
My impressions Yew • Very similar to React, but it’s
Rust • Easy to setup and learn the basics • Good documentation
My impressions Yew • Very similar to React, but it’s
Rust • Easy to setup and learn the basics • Good documentation • Looks promising
Where to go from here
Where to go from here Yew
Where to go from here Yew • Check out the
docs yew.rs
Where to go from here Yew • Check out the
docs yew.rs • Learn about Properties, Function Components, Hooks, Agents and the Router
Where to go from here Yew • Check out the
docs yew.rs • Learn about Properties, Function Components, Hooks, Agents and the Router • Checkout stylist for CSS-in-Rust
Where to go from here Yew • Check out the
docs yew.rs • Learn about Properties, Function Components, Hooks, Agents and the Router • Checkout stylist for CSS-in-Rust • Take advantage of Rust parallelism in Wasm for heavy computations
Thanks for listening ✌