Skip to main content

first_divergence

Function first_divergence 

Source
pub fn first_divergence(data: &[u8]) -> Option<usize>
Expand description

The first offset in data that does NOT match the generation recorded in its byte 0, if any.

None means every byte agrees: the file holds one generation end to end. Some(k) is the exact byte where two writes meet, which is what makes a tear report actionable rather than a suspicion. An empty slice has nothing to disagree with and is reported as intact - a file with no bytes is a separate condition and the caller counts it separately.