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
460
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
2.9k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
1.1k
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
390
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
760
Other Decks in Programming
See All in Programming
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
170
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
Agentic UI
manfredsteyer
PRO
0
160
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
New "Type" system on PicoRuby
pocke
1
940
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
Webフレームワークの ベンチマークについて
yusukebe
0
170
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
240
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
170
Oxlintのカスタムルールの現況
syumai
6
1.1k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
280
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.2k
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
Docker and Python
trallard
47
3.9k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Abbi's Birthday
coloredviolet
2
8.1k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Designing for Timeless Needs
cassininazir
1
260
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Side Projects
sachag
455
43k
Design in an AI World
tapps
1
240
Product Roadmaps are Hard
iamctodd
PRO
55
12k
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での制限緩和は希望がある!
ありがとうございました