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
970
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RustでPagerを作ってみた
RustでpeepというlessのようなPagerツールを作ってみた話。
ryochack
November 26, 2018
More Decks by ryochack
See All by ryochack
Rustでチョット気軽にセンサドライバ開発
ryochack
2
3.5k
Other Decks in Programming
See All in Programming
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
660
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
250
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
480
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
350
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.7k
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
400
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
630
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
230
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
Go 1.27 における memory allocation の高速化
andpad
0
160
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
130
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
390
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
sira's awesome portfolio website redesign presentation
elsirapls
0
320
Ruling the World: When Life Gets Gamed
codingconduct
0
290
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Abbi's Birthday
coloredviolet
3
9.3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
790
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
460
Chasing Engaging Ingredients in Design
codingconduct
0
260
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
A Tale of Four Properties
chriscoyier
163
24k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
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