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
#DeStudy #01 Rust入門
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
K.Mori
July 31, 2020
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
#DeStudy #01 Rust入門
#DeStudy #01のRust入門スライドです。
K.Mori
July 31, 2020
More Decks by K.Mori
See All by K.Mori
GraphQL入門
morikyon
1
110
Other Decks in Programming
See All in Programming
AHC070解法紹介
eijirou
0
120
Intent as Code
shoppingjaws
6
1k
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
150
setup-vp GitLab対応の裏側
naokihaba
0
110
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
440
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
180
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
120
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
210
XHTMLが残したもの
yosuke_furukawa
PRO
2
820
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
FreeBSDでZabbixを動かす
kenkino
0
310
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
210
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.9k
Side Projects
sachag
456
43k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
530
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
700
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
Transcript
もちろん俺らは抵抗するで︖ Rustで kmori (@forestython)
今⽇のテーマ 2
3 Rust
Rust • Firefox の Mozilla がつくった新しいプログラミング⾔語 • 2010年7⽉7⽇に登場 • Stack
Overflowの最も愛されているプログラミング⾔語の 2016年から2019年まで4年連続1位︕ • 以下のソフト / サービスはRustで実装 • Firefox • Dropbox • AWS Lambda (Firecracker) • Discord 4
Rustのいいところ • メリット • くっそはやい • メモリ管理が優秀である • NULL安全と型推論が存在する •
デメリット • 学習コストが半端じゃない 5
実⾏速度 • 私のダメダメな実装よりQiitaの記事⾒たほうが有益なので引⽤ ü https://qiita.com/reki2000/items/55ef54b96b2 6d80ad694 • ダイクストラ法での探索アルゴリズム(枝数30万程度) ü C++
≒ Rust > Go > Julia > Kotlin > Cython > JavaScript > Python • ちなみに私のダメダメ実装でもエラトステネスの篩(指定数以下の 素数をすべて抽出)で⽐較したところ、C++とRustは拮抗してい て、Juliaがその2倍程度、Pythonが10倍程度でした 6
メモリ管理 • メモリ管理⽅法 1. プログラマが気合で管理 (C, C++) → 開放し忘れによるメモリリークの危険性 2.
システムが⾃動で不要なメモリを集約 (GC) → 実⾏時のオーバーヘッド発⽣ • Rustの管理⽅法 ü 値の所有者(=値を格納する変数)がスコープ(=簡単 に⾔うと値を含む関数等)から出た時点で開放 ü 気合で管理してた際の⼀時的な確保/開放が実現可能かつ、 GCのようなオーバヘッドとよしなにしてくれる部分をもつ 7
NULL安全、型推論 • NULL安全 • nullに対するメソッドのコール等をしたら実⾏時に出るエラー String str = null; str.length();
// => java.lang.NullPoinerException を回避するために、コンパイル時にエラーを出すこと • 鬱陶しいnull pointer exception をテスト時に発⾒ もしくは バグのまま納品せずに済む • 型推論 • 簡単に⾔うと型を推測してくれる let num; // => この時点で num は i32型と宣⾔していない num = 100; // => がしかし100の代⼊によって⾃動で定義 8
• サンプル︓ただのFizzBuzz • https://doc.rust-jp.rs/rust-by-example-ja/fn.html • よくある感想 • 正直、型が多すぎてわからん︕ • 関数の引数でも型指定しすぎててわからん︕
• 関数の定義の順番がしていないのでパッと⾒参照関係がわからん︕ 学習コスト 9
タイトル: とりまいれてみよう 10
• Mac $ brew install rust • Ubuntu $ sudo
apt install rustc • Windows スタートボタン → Ubuntu → $sudo apt install rustc ※ Windowsを素のままで使ってコーディングは 正気の沙汰ではない(諸説あり) How to install 11