Skip to main content

compute_line_diff

Function compute_line_diff 

Source
pub fn compute_line_diff(
    old_content: &[u8],
    new_content: &[u8],
    options: &DiffOptions,
) -> Result<Vec<DiffHunk>>
Expand description

Compute line-level diff between two text contents

This function implements a simple line-based diff algorithm that:

  1. Splits both texts into lines
  2. Finds the longest common subsequence (LCS)
  3. Generates hunks with context lines

§Arguments

  • old_content - Content from the source version
  • new_content - Content from the target version
  • options - Options controlling diff generation

§Returns

Returns a vector of DiffHunk representing the changes