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
420
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
Tweet
Share
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
2
1.4k
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
2.6k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
900
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
360
Rust を開発言語として採用してからの取り組み
fill9120
1
1.8k
ストラクチャードコミュニケーション
fill9120
0
110
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
830
Rustでディープラーニング
fill9120
0
380
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
640
Other Decks in Programming
See All in Programming
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
260
NPOでのDevinの活用
codeforeveryone
0
890
What's new in AppKit on macOS 26
1024jp
0
150
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
850
Claude Code + Container Use と Cursor で作る ローカル並列開発環境のススメ / ccc local dev
kaelaela
12
6.9k
Porting a visionOS App to Android XR
akkeylab
0
670
CDK引数設計道場100本ノック
badmintoncryer
2
440
「App Intent」よくわからんけどすごい!
rinngo0302
1
100
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
140
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
Claude Code派?Gemini CLI派? みんなで比較LT会!_20250716
junholee
1
280
TypeScriptでDXを上げろ! Hono編
yusukebe
3
730
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Designing for Performance
lara
610
69k
Facilitating Awesome Meetings
lara
54
6.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Code Reviewing Like a Champion
maltzj
524
40k
Scaling GitHub
holman
460
140k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
A Modern Web Designer's Workflow
chriscoyier
695
190k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.8k
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での制限緩和は希望がある!
ありがとうございました