[][src]Struct dogear::Merger

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

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.

Methods

impl<'t> Merger<'t, DefaultDriver, DefaultAbortSignal>[src]

pub fn new(local_tree: &'t Tree, remote_tree: &'t Tree) -> Merger<'t>[src]

Creates a merger with the default merge driver.

impl<'t, D: Driver, A: AbortSignal> Merger<'t, D, A>[src]

pub fn with_driver(
    driver: &'t D,
    signal: &'t A,
    local_tree: &'t Tree,
    remote_tree: &'t Tree
) -> Merger<'t, D, A>
[src]

Creates a merger with the given merge driver and contents.

pub fn merge(self) -> Result<MergedRoot<'t>>[src]

Builds a merged tree from the local and remote trees.

Auto Trait Implementations

impl<'t, D, A> Sync for Merger<'t, D, A> where
    A: Sync,
    D: Sync

impl<'t, D, A> Unpin for Merger<'t, D, A>

impl<'t, D, A> Send for Merger<'t, D, A> where
    A: Sync,
    D: Sync

impl<'t, D, A> UnwindSafe for Merger<'t, D, A> where
    A: RefUnwindSafe,
    D: RefUnwindSafe

impl<'t, D, A> RefUnwindSafe for Merger<'t, D, A> where
    A: RefUnwindSafe,
    D: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]