Skip to main content

Crate rustik_diff

Crate rustik_diff 

Source
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§

pub use decode::Decode;
pub use encode::Encode;

Modules§

decode
Unified diff decoder.
encode
Unified diff encoder.

Structs§

BuiltinHighlighter
Pure built-in highlighter for visible diff rows.
Builtins
Built-in highlight assets loaded for one diff document.
CommitHeader
Parsed commit preamble.
ContextRequest
Repo refetch request prepared by the viewer for asynchronous context updates.
ContextUpdate
Decoded replacement files for an asynchronous context update.
DecodeError
Error produced while decoding a unified diff.
DiffDocument
A complete unified diff document.
DiffLine
A single line in a unified diff hunk.
DiffOptions
Diff viewer options.
DiffPalette
Positive and negative colors used for diff chrome.
DiffState
Mutable read-only diff viewport state.
DiffViewer
Pure diff viewer that renders into a caller-owned buffer.
FileDecoration
Decoration overlaid on a file header row.
FileDiff
A single file section in a unified diff.
FileHeader
Metadata lines that introduce a file section in a Git patch.
FileId
Stable identifier for a file section in one diff document.
FileStats
Aggregate statistics for one FileDiff.
FileTree
Stateful file tree over a diff document, usable as a standalone Widget.
Header
One Key: value header line.
HighlightKey
Cache key for one highlighted diff row.
HighlightKeyInput
Input fields used to create a HighlightKey.
HighlightRequest
Request sent from a visible diff viewport to a highlighter.
HighlightResult
Highlighted line returned by a worker.
HighlightSource
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.
HunkDecoration
Decoration overlaid on a hunk.
HunkHeader
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.
ParseCommitError
Error returned when no commit <hash> line is found in the input.
ReviewProgress
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§

ContextChange
Change to the requested hunk context.
DiffAction
Viewer action accepted by DiffViewer::apply.
DiffFocus
Focus target inside a diff document.
DiffLineKind
Role of a line inside a unified diff hunk.
DiffSide
Side of the diff used as syntax-highlighting source context.
FileKind
Kind of file-level change described by a patch file header.
FileMode
File mode in a Git diff, parsed from the octal value Git records.
FileTreeMode
File-tree rendering policy.
FileTreeTarget
Selectable target in the file tree.
HighlightOutput
Result produced by the background highlighter.
HunkFocus
Visual treatment for hunk focus.
Oid
Object identifier as it appears in a Git diff header or rev-parse output.
ViewChange
Result of applying a viewer action.

Constants§

REVIEW_PROGRESS_BAR_GLYPH
Glyph used for filled and empty review progress segments.

Traits§

DiffDecorator
Source of per-file and per-hunk decorations overlaid on a rendered diff.
DiffHighlighter
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.