Skip to main content

apply_patch

Function apply_patch 

Source
pub fn apply_patch(original: &str, patch: &str) -> Result<String, PatchError>
Expand description

Apply a unified diff patch to the original text.

Returns the patched text, or an error if the patch doesn’t apply cleanly. This is a simple line-based patch applicator — it handles standard unified diff format with @@ hunk headers and +/-/ line prefixes.