Skip to main content

compute_diff

Function compute_diff 

Source
pub fn compute_diff<'a>(old: &'a [&str], new: &'a [&str]) -> Vec<DiffLine<'a>>
Expand description

Compute the shortest edit script between old and new.

Uses a standard LCS (Longest Common Subsequence) dynamic programming approach to find the optimal alignment, then walks the DP table to produce the diff. This produces the same quality of diff as git diff for line-level changes.