Skip to main content

compute_diff_chunks

Function compute_diff_chunks 

Source
pub fn compute_diff_chunks<'a>(old: &'a str, new: &'a str) -> Vec<Chunk<'a>>
Expand description

Computes a character-level diff with adjacent chunks coalesced.

ยงContract

  • Requires: old and new are valid UTF-8 &str (enforced by the type).
  • Ensures: every returned Chunk borrows a char-boundary slice of its side, and concatenating Equal+Delete reconstructs old while Equal+Insert reconstructs new.
  • Termination: iterates similar changes once (variant: remaining changes).