Skip to main content

merge_bytes

Function merge_bytes 

Source
pub fn merge_bytes<'a>(
    ancestor: &'a [u8],
    ours: &'a [u8],
    theirs: &'a [u8],
) -> Result<Vec<u8>, Vec<u8>>
Expand description

Perform a 3-way merge between potentially non-utf8 texts

ยงExamples

use diffy::merge_bytes;

let merged = merge_bytes(
    b"\
alpha
beta
",
    b"\
ALPHA
beta
",
    b"\
alpha
beta
gamma
",
)
.unwrap();

assert_eq!(
    merged,
    b"\
ALPHA
beta
gamma
",
);