Skip to main content

Module diff

Module diff 

Source
Expand description

Line diffs of two texts, git style, for crate::widgets::DiffView: added and removed lines with their old and new line numbers, grouped into hunks with a few unchanged lines of context around each change; the unchanged runs between hunks fold away.

Diff::json compares two JSON documents by key instead of by text: both are printed with sorted keys first, so reordered keys are not noise, and a long array (cells, tiles, labels) prints as one line, so a changed array reads as one summary line (cells: 2,539 → 2,712) instead of thousands of numbers.

Plain data: no UI here, so an app (or its tests) can compute a diff without a window.

Structs§

Diff
The diff of two texts: every line, and the hunks over them.
DiffLine
One line of a diff.
Hunk
A run of changes with its context: Diff::lines[lines].

Enums§

LineKind
What a line of a diff is.

Constants§

ARRAY_SUMMARY
Arrays longer than this print as one summary line in Diff::json by default.
CONTEXT
Unchanged lines shown around each change by default.

Functions§

group_digits
2539 → "2,539".