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.5k
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
2.7k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
920
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
360
Rust を開発言語として採用してからの取り組み
fill9120
1
1.8k
ストラクチャードコミュニケーション
fill9120
0
110
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
850
Rustでディープラーニング
fill9120
0
390
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
650
Other Decks in Programming
See All in Programming
The State of Fluid (2025)
s2b
0
170
Google I/O recap web編 大分Web祭り2025
kponda
0
2.9k
未来を拓くAI技術〜エージェント開発とAI駆動開発〜
leveragestech
2
140
「リーダーは意思決定する人」って本当?~ 学びを現場で活かす、リーダー4ヶ月目の試行錯誤 ~
marina1017
0
220
コーディングは技術者(エンジニア)の嗜みでして / Learning the System Development Mindset from Rock Lady
mackey0225
2
490
QA x AIエコシステム段階構築作戦
osu
0
270
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
7
2.8k
新世界の理解
koriym
0
140
Understanding Kotlin Multiplatform
l2hyunwoo
0
260
AHC051解法紹介
eijirou
0
550
TROCCO×dbtで実現する人にもAIにもやさしいデータ基盤
nealle
0
210
JetBrainsのAI機能の紹介 #jjug
yusuke
0
200
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
RailsConf 2023
tenderlove
30
1.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
It's Worth the Effort
3n
186
28k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
810
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での制限緩和は希望がある!
ありがとうございました