pub struct MergeEngine { /* private fields */ }Expand description
The three-way merge engine.
Construct with an SDL document, then call merge() with
base/current/proposed values.
Implementations§
Source§impl MergeEngine
impl MergeEngine
Sourcepub fn new(schema: SdlDocument) -> Self
pub fn new(schema: SdlDocument) -> Self
Create a new merge engine from an SDL document.
The SDL document must be valid (call validate::sdl::validate_sdl()
first if needed).
Sourcepub fn schema(&self) -> &SdlDocument
pub fn schema(&self) -> &SdlDocument
Return a reference to the SDL schema.
Sourcepub fn merge(&self, base: Value, current: Value, proposed: Value) -> MergeResult
pub fn merge(&self, base: Value, current: Value, proposed: Value) -> MergeResult
Perform a three-way merge.
§Pipeline
- Normalize current and proposed against base.
- Build path maps for all three documents.
- Compute the union of all paths.
- For each path, resolve values and apply merge strategy.
- Check for identity mutations (protocol invariant).
- Return merged result or conflicts.
§Arguments
base- The base (reference) document.current- The current (our) document.proposed- The proposed (their) document.
§Returns
MergeResult::Merged(Value) on success, or
MergeResult::Conflicts(Vec<Conflict>) if conflicts were found.
Trait Implementations§
Source§impl Clone for MergeEngine
impl Clone for MergeEngine
Source§fn clone(&self) -> MergeEngine
fn clone(&self) -> MergeEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MergeEngine
impl RefUnwindSafe for MergeEngine
impl Send for MergeEngine
impl Sync for MergeEngine
impl Unpin for MergeEngine
impl UnsafeUnpin for MergeEngine
impl UnwindSafe for MergeEngine
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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