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でPagerを作ってみた
Search
ryochack
November 26, 2018
Programming
1
940
RustでPagerを作ってみた
RustでpeepというlessのようなPagerツールを作ってみた話。
ryochack
November 26, 2018
Tweet
Share
More Decks by ryochack
See All by ryochack
Rustでチョット気軽にセンサドライバ開発
ryochack
2
3.5k
Other Decks in Programming
See All in Programming
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
740
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
420
15年目のiOSアプリを1から作り直す技術
teakun
1
620
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
260
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
250
How to stabilize UI tests using XCTest
akkeylab
0
110
Claude Codeログ基盤の構築
giginet
PRO
7
2.5k
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
3
1.3k
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
530
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
150
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
710
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
300
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
150
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
98
Designing Experiences People Love
moore
143
24k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
970
The Curious Case for Waylosing
cassininazir
0
270
Agile that works and the tools we love
rasmusluckow
331
21k
Building AI with AI
inesmontani
PRO
1
780
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
RustでPagerを作ってみた RustのLT会! Rust入門者の集い #6 2018.11.26 @ryochack
About Me @ryochack 組み込みソフトウェア開発が仕事 システムプログラミング目当てでRust触り始めた 昨年、組み込みRustの同人誌書きました 2
RustでPager作ってみたという話 3
対象とする人 Rustが好きだ CUIが好きだ ケチ 節約が好きだ 記憶力が貧弱だ それ、tmuxやscreenでいいじゃん、って言わない人 4
Pager、使ってますよね less / more 呼吸をするように使うもの 5
でも、こんなことありませんか? 6
1. lessを起動する 2. lessでファイルを閲覧する 3. lessを終了する 4. lessで何を見ていたか忘れる 5. ※1に戻る
7
つらい 8
他のツールは… cat / less +X : ターミナルのバッファが必要以上に汚れる head / tail
: 見たい行がどこかわかってないといけない grep : マッチするものが多いとノイズが増える 9
要求 最後に見ていたものがそのままターミナルに残る ターミナルバッファを必要以上に汚さない lessのようなインタラクティブな閲覧ができる 10
peep https://github.com/ryochack/peep $ cargo install peep 11
peepの機能 指定行数内でのテキストファイル閲覧操作 Viライクなキーバンド tail -f / less +F モード 正規表現でのキーワード検索
Linux / MacOSサポート (Windowsでは動作しません) 12
Demo 13
peepの構成 14
知見(と苦しみ) 複数モジュールから参照するバッファ/Traitのハンドリング Borrow Checkerとの戦い… Rc<RefCell<xxx>> 便利だけど…? Unicode文字の表示幅のハンドリング Unicodeを取り扱うWGがある unicode-rs unicode-width
クレート ターミナル操作のテストに失敗する cargo test はデフォルトで並列テスト cargo test -- --test-threads=1 でスレッド数を1に 固定できる Shift_JISなどのUTF-8以外のファイルを入力すると死ぬ 15
まとめ CプログラマにとってRustはムズカシイ コンパイラが通ったあとの安心感がある Rustを書いてからCに戻るとつらい 16
ご清聴ありがとうございました This slide was generated by Marp 17