pub struct DiffDescriptor {
pub sources: Vec<Arc<dyn DiffParticipantSource>>,
pub watch: Vec<BufferId>,
pub participants: Vec<BufferId>,
}Expand description
The “what to diff against what” pair for a session.
sources is an arity-agnostic vector of N participant
sources, one per slot in Hunk::ranges. The engine
(crate::compute_diff) dispatches by
sources.len() — N=2 is two-way (slot 0 = baseline /
from, slot 1 = current / to), N=3 is three-way merge
(slot 0 = base, slot 1 = local, slot 2 = remote), N≥4
returns DiffEngineError::Unsupported in v1.
watch is the explicit dependency declaration:
every [BufferId] whose edits should wake this session.
The descriptor’s author (a future :diffsplit /
:Gdiff / AI-host call site) knows which sources are
buffer-backed and contributes those BufferIds into
watch. Static or git-blob sources contribute nothing.
Clone because the runtime sometimes wants a stable
snapshot of the descriptor to feed a debounced
recompute — the inner Vec<Arc<dyn ...>> and
Vec<BufferId> clones are cheap (one Arc bump per
source + a small heap allocation).
D.8.c shape (2026-05-31). Replaces the prior
baseline + current + Option<remote> named-field
triple with a single sources: Vec<...>; see
[docs/dev/architecture/n-way-diff-membership.md]
(docs/dev/architecture/n-way-diff-membership.md)
for the rationale.
Fields§
§sources: Vec<Arc<dyn DiffParticipantSource>>N participant sources in slot order. sources[i]
produces the rope at Hunk::ranges[i] after a
recompute. v1 supports N ∈ {1, 2, 3}; the engine
returns DiffEngineError::Unsupported for N≥4.
watch: Vec<BufferId>§participants: Vec<BufferId>D.5.a (2026-05-30): user-visible diff sides that should
receive diff-mode activation while this session is
registered. Distinct from Self::watch:
watchdeclares edit-event subscriptions.participantsdeclares which buffers are user-visible diff sides that should get the mode toggle.
For buffer-backed sources they coincide; they diverge
when a baseline source contributes no live buffer
(file-on-disk inline → [primary]; D.7 git baseline
→ [primary]). Two-pane is [baseline, primary]; D.6
three-way is [base, local, remote] (length 3).
Implementations§
Trait Implementations§
Source§impl Clone for DiffDescriptor
impl Clone for DiffDescriptor
Source§fn clone(&self) -> DiffDescriptor
fn clone(&self) -> DiffDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DiffDescriptor
impl !UnwindSafe for DiffDescriptor
impl Freeze for DiffDescriptor
impl Send for DiffDescriptor
impl Sync for DiffDescriptor
impl Unpin for DiffDescriptor
impl UnsafeUnpin for DiffDescriptor
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<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