pub struct Merger<'t, D = DefaultDriver, A = DefaultAbortSignal> { /* private fields */ }
Expand description

A two-way merger that produces a complete merged tree from a complete local tree and a complete remote tree with changes since the last sync.

This is ported almost directly from iOS. On iOS, the ThreeWayMerger takes a complete “mirror” tree with the server state after the last sync, and two incomplete trees with local and remote changes to the mirror: “local” and “mirror”, respectively. Overlaying buffer onto mirror yields the current server tree; overlaying local onto mirror yields the complete local tree.

Dogear doesn’t store the shared parent for changed items, so we can only do two-way merges. Our local tree is the union of iOS’s mirror and local, and our remote tree is the union of iOS’s mirror and buffer.

Unlike iOS, Dogear doesn’t distinguish between structure and value changes. The needs_merge flag notes that a bookmark changed, but not how. This means we might detect conflicts, and revert changes on one side, for cases that iOS can merge cleanly.

Fortunately, most of our users don’t organize their bookmarks into deeply nested hierarchies, or make conflicting changes on multiple devices simultaneously. A simpler two-way tree merge strikes a good balance between correctness and complexity.

Implementations

Creates a merger with the default merge driver.

Creates a merger with the given merge driver and contents.

Builds a merged tree from the local and remote trees.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.