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
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
460
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
500
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
Writing Fast Ruby
sferik
630
63k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
Navigating Weather and Climate Data
rabernat
0
520
Ruling the World: When Life Gets Gamed
codingconduct
0
330
Joys of Absence: A Defence of Solitary Play
codingconduct
1
520
Skip the Path - Find Your Career Trail
mkilby
1
230
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
The SEO identity crisis: Don't let AI make you average
varn
0
560
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は面白そうだった これからも頑張りたいと思います!
ありがとうございました!