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
450
0
Share
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
2
1.7k
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
2.9k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
1k
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
380
Rust を開発言語として採用してからの取り組み
fill9120
1
1.9k
ストラクチャードコミュニケーション
fill9120
0
130
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
1k
Rustでディープラーニング
fill9120
0
440
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
730
Other Decks in Programming
See All in Programming
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
200
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
160
ファインチューニングせずメインコンペを解く方法
pokutuna
0
310
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
感情を設計する
ichimichi
5
1.4k
iOS機能開発のAI環境と起きた変化
ryunakayama
0
180
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
120
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.5k
t *testing.T は どこからやってくるの?
otakakot
0
200
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
200
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
260
의존성 주입과 모듈화
fornewid
0
130
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
120
Practical Orchestrator
shlominoach
191
11k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
310
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Faster Mobile Websites
deanohume
310
31k
How to Ace a Technical Interview
jacobian
281
24k
Documentation Writing (for coders)
carmenintech
77
5.3k
Code Review Best Practice
trishagee
74
20k
Statistics for Hackers
jakevdp
799
230k
New Earth Scene 8
popppiees
3
2.1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
340
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
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での制限緩和は希望がある!
ありがとうございました