[][src]Enum dogear::MergeState

pub enum MergeState<'t> {
    LocalOnly(Node<'t>),
    LocalOnlyWithNewLocalStructure(Node<'t>),
    RemoteOnly(Node<'t>),
    RemoteOnlyWithNewRemoteStructure(Node<'t>),
    Local {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
    LocalWithNewLocalStructure {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
    Remote {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
    RemoteWithNewRemoteStructure {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
    Unchanged {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
    UnchangedWithNewLocalStructure {
        local_node: Node<'t>,
        remote_node: Node<'t>,
    },
}

The merge state indicates which side we should prefer, local or remote, when resolving conflicts.

Variants

LocalOnly(Node<'t>)

A local-only merge state means the item only exists locally, and should be uploaded.

LocalOnlyWithNewLocalStructure(Node<'t>)

Local-only with a new local structure means the item should be uploaded, and has new children (reparented or repositioned) locally.

RemoteOnly(Node<'t>)

A remote-only merge state means the item only exists remotely, and should be applied.

RemoteOnlyWithNewRemoteStructure(Node<'t>)

Remote-only with a new remote structure means the item should be applied, and has a new child list that should be uploaded.

Local

A local merge state means the item exists on both sides, and has newer local changes that should be uploaded.

Fields of Local

local_node: Node<'t>remote_node: Node<'t>
LocalWithNewLocalStructure

Local with a new local structure means the item has newer local changes that should be uploaded, and new children locally.

Fields of LocalWithNewLocalStructure

local_node: Node<'t>remote_node: Node<'t>
Remote

A remote merge state means the item exists on both sides, and has newer remote changes that should be applied.

Fields of Remote

local_node: Node<'t>remote_node: Node<'t>
RemoteWithNewRemoteStructure

Remote with a new remote structure means the item has newer remote changes that should be applied, and a new child list that should be uploaded.

Fields of RemoteWithNewRemoteStructure

local_node: Node<'t>remote_node: Node<'t>
Unchanged

An unchanged merge state means the item and its children are the same on both sides, and don't need to be uploaded or applied.

Fields of Unchanged

local_node: Node<'t>remote_node: Node<'t>
UnchangedWithNewLocalStructure

Unchanged with a new local structure means the item hasn't changed, but its children have. The new children should be applied locally, but not uploaded.

Fields of UnchangedWithNewLocalStructure

local_node: Node<'t>remote_node: Node<'t>

Methods

impl<'t> MergeState<'t>[src]

pub fn local_node(&self) -> Option<&Node<'t>>[src]

Returns the local node for the item, or None if the item only exists remotely. The inverse of remote_node().

pub fn remote_node(&self) -> Option<&Node<'t>>[src]

Returns the remote node for the item, or None if the node only exists locally. The inverse of local_node().

pub fn should_apply_item(&self) -> bool[src]

Returns true if the remote item should be inserted into or updated in the local tree. This is not necessarily the inverse of should_upload(), as remote items with new structure should be both applied and reuploaded, and unchanged items should be neither.

pub fn should_apply_structure(&self) -> bool[src]

Returns true if the item has a new structure (parent or children) that should be updated in the local tree.

pub fn should_upload(&self) -> bool[src]

Returns true if the item should be flagged for (re)upload.

pub fn with_new_local_structure(self) -> MergeState<'t>[src]

Returns a new merge state, indicating that the item has a new merged structure that should be applied locally.

pub fn with_new_remote_structure(self) -> MergeState<'t>[src]

Returns a new merge state, indicating that the item has a new merged structure that should be reuploaded to the server.

Trait Implementations

impl<'t> Clone for MergeState<'t>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'t> Copy for MergeState<'t>[src]

impl<'t> Debug for MergeState<'t>[src]

impl<'t> Display for MergeState<'t>[src]

Auto Trait Implementations

impl<'t> Unpin for MergeState<'t>

impl<'t> Sync for MergeState<'t>

impl<'t> Send for MergeState<'t>

impl<'t> UnwindSafe for MergeState<'t>

impl<'t> RefUnwindSafe for MergeState<'t>

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> ToString for T where
    T: Display + ?Sized
[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]