Expand description
Unified diff parsing and terminal-buffer viewing.
The viewer is intentionally I/O-free: it parses or accepts patch data,
owns read-only viewer state, and writes frames into a
rustik_tui::Buffer. Backend access is abstracted behind the
rustik_repo::DiffRepository trait so the viewer stays testable. The rustik-diff
binary owns stdin/stdout, terminals, and events.
The optional builtins feature (on by default) bundles default highlighting
assets (Builtins) and a background worker (spawn_highlighter) so
hosts get a batteries-included viewer; disable it to bring your own.
Re-exports§
Modules§
Structs§
- Builtin
Highlighter - Pure built-in highlighter for visible diff rows.
- Builtins
- Built-in highlight assets loaded for one diff document.
- Commit
Header - Parsed commit preamble.
- Context
Request - Repo refetch request prepared by the viewer for asynchronous context updates.
- Context
Update - Decoded replacement files for an asynchronous context update.
- Decode
Error - Error produced while decoding a unified diff.
- Diff
Document - A complete unified diff document.
- Diff
Line - A single line in a unified diff hunk.
- Diff
Options - Diff viewer options.
- Diff
Palette - Positive and negative colors used for diff chrome.
- Diff
State - Mutable read-only diff viewport state.
- Diff
Viewer - Pure diff viewer that renders into a caller-owned buffer.
- File
Decoration - Decoration overlaid on a file header row.
- File
Diff - A single file section in a unified diff.
- File
Header - Metadata lines that introduce a file section in a Git patch.
- FileId
- Stable identifier for a file section in one diff document.
- File
Stats - Aggregate statistics for one
FileDiff. - File
Tree - Stateful file tree over a diff document, usable as a standalone
Widget. - Header
- One
Key: valueheader line. - Highlight
Key - Cache key for one highlighted diff row.
- Highlight
KeyInput - Input fields used to create a
HighlightKey. - Highlight
Request - Request sent from a visible diff viewport to a highlighter.
- Highlight
Result - Highlighted line returned by a worker.
- Highlight
Source - File-side source text used to highlight a diff row with surrounding context.
- Highlighter
- A running background highlighter.
- Hunk
- A unified diff hunk and its body lines.
- Hunk
Decoration - Decoration overlaid on a hunk.
- Hunk
Header - Metadata from a unified diff hunk header.
- HunkId
- Stable identifier for a hunk in one diff document.
- OidError
- Error returned when an object identifier is malformed.
- Parse
Commit Error - Error returned when no
commit <hash>line is found in the input. - Review
Progress - Review progress over a fixed number of changed lines.
- RowId
- Stable identifier for a rendered hunk row in one diff document.
- Stats
- Aggregate statistics for one
DiffDocument.
Enums§
- Context
Change - Change to the requested hunk context.
- Diff
Action - Viewer action accepted by
DiffViewer::apply. - Diff
Focus - Focus target inside a diff document.
- Diff
Line Kind - Role of a line inside a unified diff hunk.
- Diff
Side - Side of the diff used as syntax-highlighting source context.
- File
Kind - Kind of file-level change described by a patch file header.
- File
Mode - File mode in a Git diff, parsed from the octal value Git records.
- File
Tree Mode - File-tree rendering policy.
- File
Tree Target - Selectable target in the file tree.
- Highlight
Output - Result produced by the background highlighter.
- Hunk
Focus - Visual treatment for hunk focus.
- Oid
- Object identifier as it appears in a Git diff header or rev-parse output.
- View
Change - Result of applying a viewer action.
Constants§
- REVIEW_
PROGRESS_ BAR_ GLYPH - Glyph used for filled and empty review progress segments.
Traits§
- Diff
Decorator - Source of per-file and per-hunk decorations overlaid on a rendered diff.
- Diff
Highlighter - Highlights diff rows requested by a
crate::DiffViewer.
Functions§
- diffstat
- Returns a compact addition and deletion summary.
- file_
count - Formats a changed-file count with the correct singular or plural noun.
- progress_
bar - Returns the standard fixed-width review progress bar.
- recoverable_
error - Returns a recoverable-error status line with the standard error badge.
- spawn_
highlighter - Spawns a background highlighter for
document.