Skip to main content

unified_diff

Function unified_diff 

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

Generate a unified diff patch for two blobs.

§Parameters

  • old_content — the old file content (empty for added files).
  • new_content — the new file content (empty for deleted files).
  • old_path — display path for the old side.
  • new_path — display path for the new side.
  • context_lines — number of context lines around changes (default: 3).

§Returns

The unified diff as a string.