Expand description
Diffs: an engine, terminal views and the inputs they read.
engine: Myers’ O(ND) diff in linear space over any hashable elements (diff_lines,diff_slices), word and character diffs for intra-line emphasis (diff_words,diff_chars),Hunkgrouping andTextDiff, whoseunifiedoutput matchesdiff -uminus timestamps.DiffView: a renderable diff, unified or side by side, of plain text, ANSI text (DiffView::ansi, which also reports style-only changes) or, with thetestingfeature, render snapshots.SourceDiff: a syntax-highlighted source diff with optional line links.ConflictFileandConflictView: three-way merge conflicts parsed from the markers a merge leaves (diff3’s base included) and shown ours, base and theirs side by side or stacked.git: agit diffparser andPatchView, a review-style renderer with a file tree, annotations and links.test_report(featuretest-report): JUnit XML and libtest JSON test results and theTestReportrenderable.assert_rich_eq!and friends (featuretesting): assertions that panic with a rendered diff.
With colour off every change stays visible: -, + and ~ (style only)
markers lead each changed line.
Re-exports§
pub use engine::Hunk;pub use engine::Op;pub use engine::TextDiff;pub use engine::diff_chars;pub use engine::diff_lines;pub use engine::diff_slices;pub use engine::diff_words;pub use engine::group_hunks;pub use engine::hunk_header;pub use engine::tokenize;
Modules§
- assert
- Assertions that fail with a rendered diff:
assert_rich_eq!,assert_rich_json_eq!,assert_render_eq!andassert_snapshot_eq!. - engine
- The diff engine: Myers’ O(ND) algorithm in linear space, hunk grouping,
token-level diffs for intra-line emphasis and the
diff -utext format. - git
git diffoutput: a parser and a review-style renderer.- test_
report - Test results: a format-neutral model, JUnit XML and libtest JSON
adapters, a renderable
TestReportand JUnit export. - transform
- Transforms over a parsed git
Patch, for aPipeline.
Structs§
- Conflict
- One conflict block.
- Conflict
Error - Why a file’s conflict markers did not parse.
- Conflict
File - A file with conflict markers, parsed.
- Conflict
Side - One side of a conflict.
- Conflict
View - A file’s merge conflicts as a renderable: each conflict numbered, with ours, base (when the markers have one) and theirs side by side or stacked, syntax highlighted, between a few lines of surrounding context.
- Diff
View - A line diff as a renderable: unified (default) or side by side, with line numbers, hunk headers and word-level emphasis on changed lines.
- Source
Diff - A syntax-highlighted diff of two versions of a source file.
Enums§
- Conflict
Layout - How a
ConflictViewlays out the sides. - Layout
- How a diff is laid out.
- Pick
- Which side of a conflict.
- Side
- Which side of a diff.
Constants§
- MAX_
CONFLICTS - The most conflicts one file may hold.
- MAX_
CONFLICT_ SOURCE - The largest input
ConflictFile::parseaccepts, in bytes (16 MiB). - STYLES
- The default styles for diff and test-report keys.
extended_themeincludes them; renderers fall back to them when a theme lacks a key.