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
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
Tell your own story through comics
letsgokoyo
1
1.1k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
490
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
450
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
250
Side Projects
sachag
456
43k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
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は面白そうだった これからも頑張りたいと思います!
ありがとうございました!