Skip to main content

anchored_unified_diff

Function anchored_unified_diff 

Source
pub fn anchored_unified_diff(
    old_content: &str,
    new_content: &str,
    old_path: &str,
    new_path: &str,
    context_lines: usize,
    anchors: &[String],
) -> String
Expand description

Compute a unified diff with anchored lines.

Anchored lines that appear exactly once in both old and new content are forced to match, splitting the diff into segments around those anchor points. This produces diffs where the anchored text stays as context and surrounding lines are shown as additions/removals.