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
440
Rustで定数式を扱う
Kazumasa Yamamoto
October 27, 2020
Tweet
Share
More Decks by Kazumasa Yamamoto
See All by Kazumasa Yamamoto
ユニークビジョンの Rust 活用事例
fill9120
2
1.6k
Rust & AWS X-Ray による分散トレーシングの実現
fill9120
0
2.8k
Rust製プロダクトを 3年以上運用して得たノウハウ
fill9120
0
1k
Messaging APIを駆使した ChatGPT ボットのUX改善
fill9120
0
370
Rust を開発言語として採用してからの取り組み
fill9120
1
1.8k
ストラクチャードコミュニケーション
fill9120
0
130
Cloudflare PagesにVue.jsアプリをデプロイしてみた
fill9120
0
960
Rustでディープラーニング
fill9120
0
420
LINE BotとLIFFを使って謎解きアプリを作った話
fill9120
0
700
Other Decks in Programming
See All in Programming
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.7k
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
5.6k
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
780
CSC307 Lecture 03
javiergs
PRO
1
480
余白を設計しフロントエンド開発を 加速させる
tsukuha
6
1.8k
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.6k
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
Implementation Patterns
denyspoltorak
0
230
rack-attack gemによるリクエスト制限の失敗と学び
pndcat
0
230
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
180
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
650
Grafana:建立系統全知視角的捷徑
blueswen
0
300
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
85
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Building an army of robots
kneath
306
46k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
420
Leo the Paperboy
mayatellez
4
1.3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
140
Technical Leadership for Architectural Decision Making
baasie
1
220
Scaling GitHub
holman
464
140k
Color Theory Basics | Prateek | Gurzu
gurzu
0
180
A better future with KSS
kneath
240
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
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での制限緩和は希望がある!
ありがとうございました