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
470
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
2
1.8k
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
3k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
1.1k
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
400
Rust を開発言語として採用してからの取り組み
fill9120
1
1.9k
ストラクチャードコミュニケーション
fill9120
0
140
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
1.1k
Rustでディープラーニング
fill9120
0
460
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
770
Other Decks in Programming
See All in Programming
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
350
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
今さら聞けない .NET CLI
htkym
0
190
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
560
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
780
FDEが実現するAI駆動経営の現在地
gonta
2
280
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
830
Foundation Models frameworkで画像分析
ryodeveloper
1
610
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
470
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
590
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
470
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
260
Building AI with AI
inesmontani
PRO
1
1.1k
Designing Powerful Visuals for Engaging Learning
tmiket
1
490
The SEO identity crisis: Don't let AI make you average
varn
0
530
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Statistics for Hackers
jakevdp
799
230k
Music & Morning Musume
bryan
47
7.3k
Raft: Consensus for Rubyists
vanstee
141
7.6k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
440
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
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での制限緩和は希望がある!
ありがとうございました