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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ryochack
November 26, 2018
Programming
960
1
Share
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
Swiftのレキシカルスコープ管理
kntkymt
0
210
RTSPクライアントを自作してみた話
simotin13
0
480
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
220
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
310
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
Oxcを導入して開発体験が向上した話
yug1224
4
280
CSC307 Lecture 17
javiergs
PRO
0
310
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
340
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.1k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
490
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.5k
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
Design in an AI World
tapps
1
220
Faster Mobile Websites
deanohume
310
31k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
30 Presentation Tips
portentint
PRO
1
320
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Utilizing Notion as your number one productivity tool
mfonobong
4
310
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
550
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
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