Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
技術領域を広げるためのRustのすゝめ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shuhei Yamashita
October 26, 2019
Programming
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
技術領域を広げるためのRustのすゝめ
水戸エンジニア勉強会 #3
Shuhei Yamashita
October 26, 2019
More Decks by Shuhei Yamashita
See All by Shuhei Yamashita
フルリモートマネージャーしくじり先生
nappa723
0
350
Other Decks in Programming
See All in Programming
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
golang-bob.pdf
iwatsukayura
0
130
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
contenteditable と日本語入力に向き合う
colorful12
0
200
Event is what happens
moro
2
770
Railsバージョンを4倍にした話
optim
0
350
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
135
10k
Optimising Largest Contentful Paint
csswizardry
37
4k
Scaling GitHub
holman
464
140k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Deep Space Network (abreviated)
tonyrice
0
370
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
For a Future-Friendly Web
brad_frost
184
10k
Transcript
Rust @b7472
> whoami
> whoami w ͳͬͺ !C w גࣜձࣾετϥΠϓσύʔτϝϯτ w ϑϧϦϞʔτΤϯδχΞϦϯάϚωʔδϟʔ
> whoami w ͳͬͺ !C w גࣜձࣾετϥΠϓσύʔτϝϯτ w ϑϧϦϞʔτΤϯδχΞϦϯάϚωʔδϟʔ
w ࠷ۙೣΛࣂ͍࢝Ί·ͨ͠
None
None
ೣ༷ͷͨΊʹࣄͯ͠·͢
Ͱɺຊ
ࠓ3VTUͷڭΛ͠ʹདྷ·ͨ͠☺
None
3VTUͬͯΔਓ
3VTUॻ͍ͨ͜ͱ͋Δਓ
ଟ΄ͱΜͲ͍ͳ͍ͣ
3VTUJTԿ
3VTUJT w .P[JMMB͕ࢧԉ w ʹ"84͕ࢧԉ͢Δͱൃද/&8 w ৽͠ΊͷݴޠʢϓϨΞϧϑΝ൛͕ʣ w dͷʮ࠷Ѫ͞Ε͍ͯΔϓϩάϥϛϯάݴޠʯͰ࿈ଓҐ w
4UBDL0WFSqPX%FWFMPQFS4VSWFZ w $$ ͷସ w ڧ͍੩తܕ͚ w ($ΛΘͳ͍Ϧιʔεཧ ݁ߏγϏΞͳύϑΥʔϚϯεٻΊΒΕΔͱ͜ΖͰ࠾༻ࣄྫ͋Γ
Dz3VTUzBDFBO
3VTUͷ͍͍ͱ͜Ζ
3VTUͷ͍͍ͱ͜Ζ w ωΠςΟϒίϯύΠϧͳͷͰόΠφϦ୯ମͰಈ࡞͢Δ w ϚϧνϓϥοτϑΥʔϜ w ܕਪ͕ڧྗ w υΩϡϝϯτΤίγεςϜ͕๛ w
ߴʢ$$ ฒʣ w ҆શੑ͕ߴ͍ w جຊతʹϝϞϦϦʔΫ͕ൃੜ͠ͳ͍ w ʮॴ༗ݖʯͱ͍͏֓೦Ͱཧ w ͵ΔΆൃੜ͠ͳ͍ όΠφϦ୯ମͰಈ࡞͢Δ͔ΒTFEͱ͔ίϚϯυΛ3VTUͰॻ͍ͯΔਓ݁ߏଟ͍
ίʔυαϯϓϧ
fn main() { println!("Hello, world!"); } )FMMP8PSME
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { let count: u8 = 10; let message
= "Hello"; let mut mut_message = "World"; // message = "Hello!!!"; < -- Error mut_message = "World!!!"; println!("{} {}", message, mut_message); if count == 10 { println!("count is 10"); } let count_message = if count == 10 { "count is 10" } else { "count is not 10" }; println!("{}", count_message); } جૅߏจ
fn main() { match division(20, 5) { Ok(result) => println!("Success
: {}", result), Err(msg) => println!("Failed : {}", msg), } } fn division(x: u8, y: u8) -> Result<u8, String> { if x == 0 || y == 0 { Err("zero devision".to_string()) } else { Ok(x/y) } } ΤϥʔϋϯυϦϯά
fn main() { match division(20, 5) { Ok(result) => println!("Success
: {}", result), Err(msg) => println!("Failed : {}", msg), } } fn division(x: u8, y: u8) -> Result<u8, String> { if x == 0 || y == 0 { Err("zero devision".to_string()) } else { Ok(x/y) } } ΤϥʔϋϯυϦϯά
fn main() { match division(20, 5) { Ok(result) => println!("Success
: {}", result), Err(msg) => println!("Failed : {}", msg), } } fn division(x: u8, y: u8) -> Result<u8, String> { if x == 0 || y == 0 { Err("zero devision".to_string()) } else { Ok(x/y) } } ΤϥʔϋϯυϦϯά
fn main() { match division(20, 5) { Ok(result) => println!("Success
: {}", result), Err(msg) => println!("Failed : {}", msg), } } fn division(x: u8, y: u8) -> Result<u8, String> { if x == 0 || y == 0 { Err("zero devision".to_string()) } else { Ok(x/y) } } ΤϥʔϋϯυϦϯά
struct Point { x: i32, y: i32, } fn main()
{ let origin = Point { x: 0, y: 0 }; // origin: Point println!("The origin is at ({}, {})", origin.x, origin.y); } ߏମ
struct Circle { x: f64, y: f64, radius: f64, }
impl Circle { fn area(&self) -> f64 { std::f64::consts::PI * (self.radius * self.radius) } } τϨΠτ
ॴ༗ݖ fn main() { let v = vec![1, 2, 3];
let v2 = v; println!("v[0] is: {}", v[0]); }
ॴ༗ݖ fn main() { let v = vec![1, 2, 3];
let v2 = v; println!("v[0] is: {}", v[0]); }
ॴ༗ݖ fn main() { let v = vec![1, 2, 3];
let v2 = v; println!("v[0] is: {}", v[0]); }
ॴ༗ݖ fn main() { let v = vec![1, 2, 3];
let v2 = v; println!("v[0] is: {}", v[0]); } ͜Ε͚ͩͰ-5ຊͰ͖ΔͷͰׂѪʂʂ
3VTUͷಛ
3VTUͷಛ w ݴޠ༷͕͔ͳΓߗ͍ w ΧδϡΞϧͳԥΓॻ͖ʹ͔ͳ͍ w ٯʹݴ͏ͱ3VTUͰॻ͚Ε͋Δఔ҆શੑ͕୲อ͞Ε͍ͯ Δ w ίϯύΠϥ͕ΨνΕͯ͘͠Δ
w ֮͑Δ͜ͱ͕ଟ͍ w ͿͬͪΌ͚࠷ॳ·ͱʹίʔυ͔͚ͳ͍ w ΤϯδχΞॳ৺ऀʹΦεεϝͰ͖ͳ͍ w ୈҰݴޠͱֶͯ͠Ϳͷ͓͢͢Ί͠ͳ͍ɻຊʹɻ ίϯύΠϥ༷͕పఈతʹมͳͱ͜ΖΛୟ͍ͯ͘Δ
ɹͰɺ
Rust @b7472
Rust @b7472
ٕज़ྖҬΛ͛Δ
3VTUʮϓϥεΞϧϑΝʯͷ ֶͼΛಘΔͷʹ͍͍ͯΔͷͰ
8FCΤϯδχΞ º
8FCΤϯδχΞ º 8FC"TTFNCMZ ϑϩϯτք۾Ͱͪΐ͍ͪΐ͍ʹ্͕Δͭ
όοΫΤϯυΤϯδχΞ º
όοΫΤϯυΤϯδχΞ º ϨΠϠʔ ΤϯδχΞྺ͋Δఔ͔͞ͶΔͱʮϨΠϠʔΒͳ͖Όʯͬͯ୭͠ࢥ͏ΑͶ
ೖ༻υΩϡϝϯτ • Writing an OS in Rust • https://os.phil-opp.com/ •
Rust and WebAssembly • https://rustwasm.github.io/docs/book/ • rust-raspi3-OS-tutorials • https://github.com/rust-embedded/rust-raspi3-OS-tutorials ӳޠͷษڧͱࢥͬͯ
ٕज़ྖҬΛ͛Δ
ٕज़ɹɹΛਂΊΔ
ಛఆݴޠʹಛԽͨ͠ΤϯδχΞ º
ಛఆݴޠʹಛԽͨ͠ΤϯδχΞ º ৽͍͠ύϥμΠϜͷܦݧ DMBTTͱ͔ແ͍Μ͢Α
ίʔσΟϯάྗΛ͍͋͛ͨΤϯδχΞ º
ίʔσΟϯάྗΛ͍͋͛ͨΤϯδχΞ º ݫ֨ͳݴޠ༷ͷίʔσΟϯάܦݧ ٱʑʹಈతܕ͚ͷεΫϦϓτੈքʹͬͨΒෆ҆Ͱࢮʹͦ͏ͩͬͨ
3VTUͷಛ w ݴޠ༷͕͔ͳΓߗ͍ w ΧδϡΞϧͳԥΓॻ͖ʹ͔ͳ͍ w ٯʹݴ͏ͱ3VTUͰॻ͚Ε͋Δఔ҆શੑ͕୲อ͞Ε͍ͯ Δ w ίϯύΠϥ͕ΨνΕͯ͘͠Δ
w ֮͑Δ͜ͱ͕ଟ͍ w ͿͬͪΌ͚࠷ॳ·ͱʹίʔυ͔͚ͳ͍ w ΤϯδχΞॳ৺ऀʹΦεεϝͰ͖ͳ͍ w ୈҰݴޠͱֶͯ͠Ϳͷ͓͢͢Ί͠ͳ͍ɻຊʹɻ 3VTUͰͳ͙Γॻ͖Ͱ͖ΔΑ͏ʹͳͬͨΒڧ͍
3VTUͰ͋ΔఔίʔυΛॻ͚ΔΑ͏ʹͳͬͯ͘Δͱ ݩͷݴޠͰίʔυΛॻ࣌͘ͷઢ͕มΘΓ·͢ ˞ݸਓͷײͰ͢
औ͖ͬͭͮΒ͍ݴޠͰ͕͢ ٕज़ྖҬΛ͛ΔͨΊʹ͍͔͕Ͱ͠ΐ͏͔
ೖ༻υΩϡϝϯτ • TRPL (The Rust Programming Language) • https://doc.rust-lang.org/book/ •
TRPL Japanese Edition • https://doc.rust-jp.rs/book/second-edition/ ຊޠ༁͋Γ͕ͯ͐
3VTU͍͍ͧ
Ҏ্ɺ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠