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
ieiriyuki
January 16, 2019
430
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rust超初心者が頑張って勉強するの巻き
ieiriyuki
January 16, 2019
More Decks by ieiriyuki
See All by ieiriyuki
データドリブンな幸せになる方法
ieiriyuki
0
91
dynamic_pricing_fundamentals
ieiriyuki
1
1.5k
ラズパイとスラックで作るミーティングスペースモニタリングツール
ieiriyuki
2
760
スキルアップ・キャッチアップこうやってます
ieiriyuki
1
650
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
Are puppies a ranking factor?
jonoalderson
2
4.1k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Building AI with AI
inesmontani
PRO
1
1.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Making the Leap to Tech Lead
cromwellryan
135
10k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Transcript
Rust超初心者が 頑張って勉強するの巻き Shinjuku.rs #2 2019-01-16
自己紹介 ieiriyuki データサイエンティスト もっぱらPythonで機械学習モデルを書く 大学時代は進化シミュレーションのためにC/C++を少しやっていた 「C/C++に死を」という記事でRustを知る (C++は死ぬ必要ないです)
t_wadaさんのスライド 12月ごろあたりから少し時間ができたので、Rustをちゃんと勉強しようと思い立つ 毎日ちょっとずつでもコードを書く GitHubに上げる (https://github.com/ieiriyuki/rust-hello) 写経なので意味があるかは... https://speakerdeck.com/rtechkouhou/enziniatositekofalsexian-sheng-kifalsekorutameni?slide=49
やっていること ひたすらにRust by Example を写経する 今std miscの部分 1月中には終わる?
割と順調にいっています 週末にまとめてやるよりも、モチベ的にも 記憶的にもやりやすい もうちょっと一日当たりの量を増やしたい (今は20~40分くらい)
Borrow fn eat_box_i32(boxed_i32: Box<i32>) { println!("Destroying box that contains {}",
boxed_i32); } fn borrow_i32(borrowed_i32: &i32) { println!("This int is: {}", borrowed_i32); } fn main() { let boxed_i32 = Box::new(5_i32); let stacked_i32 = 6_i32; borrow_i32(&boxed_i32); borrow_i32(&stacked_i32); { let _ref_to_i32: &i32 = &boxed_i32; eat_box_i32(boxed_i32); // Error ! } eat_box_i32(boxed_i32); } ここで借用しているためデータを破 棄するような操作はできない
Bound <>で囲まれているところが、バウンドを指定している とはいえ、バウンドの価値はよくわかっていない... ジェネリクスがあるのは便利だってGo勉強している人が言ってた #[derive(Debug)] struct Ref<'a, T: 'a>(&'a T);
// `Ref` contains a reference to a generic type `T` that has // an unknown lifetime `'a`. `T` is bounded such that any // *references* in `T` must outlive `'a`. Additionally, the lifetime // of `Ref` may not exceed `'a`.
Traits Sheepというstructに対し て、Animalというトレイトを 実装しています よく使うメソッドの集合っ てことでしょうか? struct Sheep { naked:
bool, name: &'static str } trait Animal { fn new(name: &'static str) -> Self; fn name(&self) -> &'static str; fn noise(&self) -> &'static str; fn talk(&self) { println!("{} says {}", self.name(), self.noise()); } } // ~~ skip ~~ // impl Animal for Sheep { fn new(name: &'static str) -> Sheep { Sheep { name: name, naked: false } } fn name(&self) -> &'static str { self.name } fn noise(&self) -> &'static str { if self.is_naked() { "baaaaah?" } else { "baaaaah!" } } fn talk(&self) { println!("{} pauses briefly... {}", self.name, self.noise()); } }
そのうち本のほうも手を出す 手元にはある 来年から本気出す
今後やりたいこと JavaやC++で機械学習実装できるんなら、Rustでもできるはず 価値があるかは知らない...笑 とりあえずやってみたい 競プロでもRust使えるらしい (AtCoderはバージョンが古いらしい...) 別のRust LTでみたWeb Assemblyは面白そうだった これからも頑張りたいと思います!
ありがとうございました!