Skip to main content

create_patch_bytes

Function create_patch_bytes 

Source
pub fn create_patch_bytes<'a>(
    original: &'a [u8],
    modified: &'a [u8],
) -> Patch<'a, [u8]>
Expand description

Create a patch between two potentially non-utf8 texts

ยงExamples

use diffy::create_patch_bytes;

let patch = create_patch_bytes(b"alpha\nbeta\n", b"alpha\nBETA\n");

assert_eq!(
    patch.to_bytes(),
    b"\
--- original
+++ modified
@@ -1,2 +1,2 @@
 alpha
-beta
+BETA
",
);