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
360
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
Tweet
Share
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
0
460
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
1.8k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
600
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
320
Rust を開発言語として採用してからの取り組み
fill9120
1
1.7k
ストラクチャードコミュニケーション
fill9120
0
81
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
510
Rustでディープラーニング
fill9120
0
320
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
540
Other Decks in Programming
See All in Programming
Goのmultiple errorsについて (2024年4月版)
syumai
3
640
PHPはいつから死んでいるかの調査
chiroruxx
1
400
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Ruby Pattern Matching
bkuhlmann
0
920
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
230
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
190
Site Reliability Engineering for GMO
pyama86
8
1k
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
140
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
110
Code Reviews
bkuhlmann
4
890
Rethinking UI building strategies @ SFI 2024
letelete
0
270
入門 AWS Amplify Gen2 / Introduction to AWS Amplify Gen2
genkiogasawara
1
330
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
16
2.6k
Atom: Resistance is Futile
akmur
259
25k
Debugging Ruby Performance
tmm1
70
11k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Designing on Purpose - Digital PM Summit 2013
jponch
110
6.5k
Visualization
eitanlees
136
14k
Testing 201, or: Great Expectations
jmmastey
28
6.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Being A Developer After 40
akosma
57
580k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
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での制限緩和は希望がある!
ありがとうございました