Crate diffr_lib

Source
Expand description

Algorithms to compute diffs.

This module implements various algorithms described in E. Myers paper: An O(ND) Difference Algorithm and Its Variations.

The main entrypoint is diff, which allows to compute the longest common subsequence between two sequences of byte slices.

Structs§

DiffInput
A pair of Tokenizations to compare.
HashedSlice
A wrapper around a token, optimized for equality comparison.
HashedSpan
A span of bytes and a hash of the content it refers.
LineSplit
A wrapper around a vector of bytes that keeps track of end of lines.
LineSplitIter
NormalizationResult
The result of optimize_partition. This is mostly used by shared_segments.
SharedSegments
The shared segments between both inputs of optimize_partition.
Snake
A pair of spans with the same content in two different slices.
Tokenization
A tokenized slice of bytes.

Functions§

diff
Compute the longest common subsequence for input into dst.
diff_sequences_bidirectional
Compute the length of the edit script for input. This is the bidirectional version.
diff_sequences_simple_backward
Compute the length of the edit script for input. This is the backward version.
diff_sequences_simple_forward
Compute the length of the edit script for input. This is the forward version.
optimize_partition
Minimize the number of elements when partitioning seq according to lcs. lcs is a subsequence of seq.
tokenize
Tokenize data from src from the position ofs into tokens.