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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ryochack
November 26, 2018
Programming
980
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
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
180
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
180
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
680
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
970
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
150
高専キャリア LT 発表内容
crysta1221
6
5.6k
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
業務時間外もAIに働いてもらう話
colorful12
3
10k
AIエージェント時代のコードレビューを設計する
nogu66
6
2.6k
スマート反転とウェブアクセシビリティ
camiha
0
150
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
220
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
230
Test your architecture with Archunit
thirion
2
2.4k
Prompt Engineering for Job Search
mfonobong
0
440
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
510
Deep Space Network (abreviated)
tonyrice
0
290
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
680
Rails Girls Zürich Keynote
gr2m
96
14k
Building an army of robots
kneath
306
46k
The Language of Interfaces
destraynor
162
27k
The Cost Of JavaScript in 2023
addyosmani
55
10k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Designing Powerful Visuals for Engaging Learning
tmiket
1
530
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