Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rustで定数式を扱う
Search
Kazumasa Yamamoto
October 27, 2020
Programming
0
370
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
Tweet
Share
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
0
730
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
2k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
680
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
330
Rust を開発言語として採用してからの取り組み
fill9120
1
1.7k
ストラクチャードコミュニケーション
fill9120
0
85
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
600
Rustでディープラーニング
fill9120
0
330
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
570
Other Decks in Programming
See All in Programming
Mastering Developer Experience: A Roadmap for Success 【開発生産性Conference 2024】
findyinc
1
380
feature環境をGitHub ActionsとCloudFormationでいい感じに管理する
nealle
2
310
Introduction to GitOps
hwchiu
0
110
[After Kotlin Fest 2024 LT Night @ Sansan] もっともっとKotlinを好きになる!K2 Compiler Pluginで遊んでみよう!
kitakkun
2
260
Jetpack for KMP
fornewid
1
290
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.9k
Trial
cairolibrary720
1
130
英語
s_shimotori
1
220
Rust.Nagoya #1
codemountains
0
170
Play Billing Library 7.0.0 変更点まとめ@potatotips#88
kako351
0
160
Exploring the Gradually Lost Technical Skills in the Cloud Native Era
hwchiu
2
3.9k
開発部に不満を持っていたCSがエンジニアにジョブチェンしてわかった「勝手に諦めない」ことの大切さ
sakuraikotone
28
16k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
166
14k
Documentation Writing (for coders)
carmenintech
63
4.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Writing Fast Ruby
sferik
623
60k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
35
6.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
245
1.2M
Practical Orchestrator
shlominoach
185
10k
The Invisible Customer
myddelton
117
13k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
How to train your dragon (web standard)
notwaldorf
79
5.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
248
12k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
662
120k
Transcript
Rustで定数式を扱う ユニークビジョン株式会社 山本 一将
自己紹介 2 ⚫ 名前:山本 一将(@kyamamoto9120) ⚫ 所属:ユニークビジョン株式会社 ⚫ 言語:C++, Rust,
Python, Ruby ⚫ 趣味:将棋、キャンプ、DIY、野球観戦 ⚫ 実績:2015年 世界コンピュータ将棋選手権9位
アジェンダ 3 ① 定数式とは何か ② Rustの定数式の状況 ③ 簡単な使用方法(フィボナッチ数列を例に)
定数式とは 4 • コンパイル時に評価可能な式のこと • Rustでは const fn で始まる関数が定数式となる
Rustにおける定数式 5 ① 1.31.0から導入 • ローカル変数が使えない • ループ文、制御文が使えない • 引数を&mutにできない
② 1.46.0までに徐々に制限緩和 • ローカル変数が使える! • matchやwhileが使える!
現時点での制限 6 ① for文は使えない ② 評価できる式の深さに制限がある
まとめ 7 ⚫ 制限が一部緩和されたがまだまだ実用レベルではない • 自由度はまだC++14のconstexprにも届かない • 標準ライブラリの対応もまだまだ ⚫ 当面はlazy_static!を使用した方が幸せ
⚫ それでも1.46.0での制限緩和は希望がある!
ありがとうございました