MCPcopy Create free account
hub / github.com/Mic92/nix-diff-rs / diff_optional_bytes

Method diff_optional_bytes

src/diff.rs:431–448  ·  view source on GitHub ↗
(
        &self,
        s1: &Option<Vec<u8>>,
        s2: &Option<Vec<u8>>,
    )

Source from the content-addressed store, hash-verified

429 }
430
431 fn diff_optional_bytes(
432 &self,
433 s1: &Option<Vec<u8>>,
434 s2: &Option<Vec<u8>>,
435 ) -> Option<StringDiff> {
436 match (s1, s2) {
437 (Some(a), Some(b)) => self.diff_bytes(a, b),
438 (None, None) => None,
439 (Some(a), None) => Some(StringDiff {
440 old: a.clone(),
441 new: Vec::new(),
442 }),
443 (None, Some(b)) => Some(StringDiff {
444 old: Vec::new(),
445 new: b.clone(),
446 }),
447 }
448 }
449
450 fn diff_file_contents(&self, content1: &[u8], content2: &[u8]) -> TextDiff {
451 // Check if content is binary

Callers 1

diff_outputsMethod · 0.80

Calls 1

diff_bytesMethod · 0.80

Tested by

no test coverage detected