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§
- Diff
Input - A pair of Tokenizations to compare.
- Hashed
Slice - A wrapper around a token, optimized for equality comparison.
- Hashed
Span - A span of bytes and a hash of the content it refers.
- Line
Split - A wrapper around a vector of bytes that keeps track of end of lines.
- Line
Split Iter - Normalization
Result - The result of
optimize_partition
. This is mostly used byshared_segments
. - Shared
Segments - 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
intodst
. - 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 tolcs
.lcs
is a subsequence ofseq
. - tokenize
- Tokenize data from
src
from the positionofs
intotokens
.