Skip to main content

chunk_diff_with_params

Function chunk_diff_with_params 

Source
pub fn chunk_diff_with_params(
    content: &str,
    head_lines: usize,
    tail_lines: usize,
) -> (Cow<'_, str>, bool, usize)
Expand description

Chunks a large diff with explicit head and tail line counts.

When the diff exceeds head_lines + tail_lines, the middle section is replaced with a placeholder. Returns the original content unchanged (as a borrowed reference) when no truncation is needed, avoiding allocation.

§Arguments

  • content — The full diff content.
  • head_lines — Number of lines to keep from the beginning.
  • tail_lines — Number of lines to keep from the end.

§Returns

A tuple of (chunked_content, was_truncated, removed_lines).