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,
    indent_heuristic: bool,
    quote_path_fully: bool,
) -> 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).
  • Inter-hunk context defaults to 0 (see unified_diff_with_prefix).

§Returns

The unified diff as a string.