$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RustでPagerを作ってみた
Search
ryochack
November 26, 2018
Programming
1
930
RustでPagerを作ってみた
RustでpeepというlessのようなPagerツールを作ってみた話。
ryochack
November 26, 2018
Tweet
Share
More Decks by ryochack
See All by ryochack
Rustでチョット気軽にセンサドライバ開発
ryochack
2
3.4k
Other Decks in Programming
See All in Programming
SwiftUIで本格音ゲー実装してみた
hypebeans
0
500
認証・認可の基本を学ぼう後編
kouyuume
0
250
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.3k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
120
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.4k
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
110
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
160
Deno Tunnel を使ってみた話
kamekyame
0
240
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
430
開発に寄りそう自動テストの実現
goyoki
2
1.4k
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
2
66
Crafting Experiences
bethany
0
22
SEO for Brand Visibility & Recognition
aleyda
0
4.1k
WENDY [Excerpt]
tessaabrams
8
35k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
ラッコキーワード サービス紹介資料
rakko
0
1.8M
WCS-LA-2024
lcolladotor
0
390
Faster Mobile Websites
deanohume
310
31k
Getting science done with accelerated Python computing platforms
jacobtomlinson
0
78
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
0
94
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