Struct treediff::tools::Merger

source ·
pub struct Merger<K, V, BF, F> { /* private fields */ }
Expand description

A Delegate which applies differences to a target object.

It wraps the target object and applies all calls by the diff algorithm to it, which changes it in some way.

Custom resolver functions can be provided to arbitrarily alter the way the merge is performed. This allows you, for example, to keep your own meta-data, or to implement custom conflict resolutions.

§Examples

Please see the tests for usage examples.

Implementations§

source§

impl<K, V, BF, F> Merger<K, V, BF, F>

source

pub fn into_inner(self) -> V

Consume the merger and return the contained target Value, which is the result of the merge operation.

source

pub fn filter_mut(&mut self) -> &mut BF

Returns a mutable borrow to the MutableFilter instance

source

pub fn filter(&self) -> &BF

Returns a borrow to the MutableFilter instance

source§

impl<'a, V, BF, F> Merger<V::Key, V, BF, F>
where V: Mutable + 'a + Clone, F: MutableFilter, BF: BorrowMut<F>,

source

pub fn with_filter(v: V, f: BF) -> Self

Return a new Merger with the given initial value v and the filter f

Trait Implementations§

source§

impl<K, V, BF, F> AsRef<V> for Merger<K, V, BF, F>

source§

fn as_ref(&self) -> &V

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a, K, V, F, BF> Delegate<'a, K, V> for Merger<K, V, BF, F>
where V: Mutable<Key = K, Item = V> + Clone + 'a, K: Clone + Display, F: MutableFilter, BF: BorrowMut<F>,

source§

fn push(&mut self, k: &K)

… we recurse into the Value at the given Key. Read more
source§

fn pop(&mut self)

… we have processed all items and leave the object previously pushed.
source§

fn removed<'b>(&mut self, k: &'b K, v: &'a V)

… the Value v at the given Key k should be removed. Read more
source§

fn added<'b>(&mut self, k: &'b K, v: &'a V)

.. the Value v at the given Key k should be added. Read more
source§

fn unchanged<'b>(&mut self, v: &'a V)

The Value v was not changed.
source§

fn modified<'b>(&mut self, old: &'a V, new: &'a V)

… the old Value was modified, and is now the new Value.
source§

impl<'a, V> From<V> for Merger<V::Key, V, DefaultMutableFilter, DefaultMutableFilter>
where V: Mutable + 'a + Clone,

source§

fn from(v: V) -> Self

Return a new merger with the given initial value v, and the DefaultMutableFilter.

Auto Trait Implementations§

§

impl<K, V, BF, F> RefUnwindSafe for Merger<K, V, BF, F>

§

impl<K, V, BF, F> Send for Merger<K, V, BF, F>
where BF: Send, F: Send, K: Send, V: Send,

§

impl<K, V, BF, F> Sync for Merger<K, V, BF, F>
where BF: Sync, F: Sync, K: Sync, V: Sync,

§

impl<K, V, BF, F> Unpin for Merger<K, V, BF, F>
where BF: Unpin, F: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, BF, F> UnwindSafe for Merger<K, V, BF, F>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.