pub struct Hunk {
pub kind: HunkKind,
pub ranges: SmallVec<[LineRange; 3]>,
pub refine: RegionRefinement,
}Expand description
A single hunk: a contiguous region of change across the participating documents.
ranges.len() matches the document arity:
- Two-way:
[a_range, b_range] - Three-way:
[base_range, local_range, remote_range]
The SmallVec inline capacity of 3 covers both cases
without allocation.
Fields§
§kind: HunkKind§ranges: SmallVec<[LineRange; 3]>§refine: RegionRefinementDR.4 (2026-08-12): intra-line refinement for this hunk — which BYTES of each changed line actually changed.
Per side, not per pair (DR.5, 2026-08-12). refine.removed
is indexed by line - ranges[0].start and refine.added by
line - ranges[1].start; the two need not be the same length,
which is the whole point — the predecessor shape was pair-keyed
and so could not describe an n-removed / m-added hunk at
all, making the commonest “rewrite a line and add a comment
above it” hunk decline refinement outright.
Empty for a hunk that declined (Add / Remove, identical
regions, a wholesale rewrite, or one past the size cap), which
renders exactly as it did before refinement existed.
Carried ON the hunk rather than in a parallel map keyed by hunk index, so refinement cannot desynchronise from the ranges it describes — the same “one thing being shifted” property the sign-map derivation relies on. Computed once at diff time, not per render.
Trait Implementations§
impl Eq for Hunk
impl StructuralPartialEq for Hunk
Auto Trait Implementations§
impl Freeze for Hunk
impl RefUnwindSafe for Hunk
impl Send for Hunk
impl Sync for Hunk
impl Unpin for Hunk
impl UnsafeUnpin for Hunk
impl UnwindSafe for Hunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more