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
430
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
950
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
360
Rust を開発言語として採用してからの取り組み
fill9120
1
1.8k
ストラクチャードコミュニケーション
fill9120
0
120
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
870
Rustでディープラーニング
fill9120
0
400
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
670
Other Decks in Programming
See All in Programming
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
410
Webサーバーサイド言語としてのRustについて
kouyuume
0
1.5k
技術的負債の正体を知って向き合う
irof
0
200
CSC305 Lecture 09
javiergs
PRO
0
280
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
130
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
230
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
240
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
CSC305 Lecture 05
javiergs
PRO
0
230
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
0
120
Devoxx BE - Local Development in the AI Era
kdubois
0
130
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Facilitating Awesome Meetings
lara
56
6.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
990
Raft: Consensus for Rubyists
vanstee
140
7.1k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
GraphQLとの向き合い方2022年版
quramy
49
14k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
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での制限緩和は希望がある!
ありがとうございました