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
92
dynamic_pricing_fundamentals
ieiriyuki
1
1.5k
ラズパイとスラックで作るミーティングスペースモニタリングツール
ieiriyuki
2
770
スキルアップ・キャッチアップこうやってます
ieiriyuki
1
650
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
720
Done Done
chrislema
187
17k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
The SEO Collaboration Effect
kristinabergwall1
1
600
Prompt Engineering for Job Search
mfonobong
0
540
Tell your own story through comics
letsgokoyo
1
1.1k
We Are The Robots
honzajavorek
0
410
Designing for Timeless Needs
cassininazir
1
530
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
290
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は面白そうだった これからも頑張りたいと思います!
ありがとうございました!