Struct treediff::tools::Merger
[−]
[src]
pub struct Merger<K, V, BF, F> { /* fields omitted */ }
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.
Methods
impl<K, V, BF, F> Merger<K, V, BF, F>
[src]
fn into_inner(self) -> V
Consume the merger and return the contained target Value, which is the result of the merge operation.
fn filter_mut(&mut self) -> &BF
Returns a mutable borrow to the MutableFilter
instance
fn filter(&self) -> &BF
Returns a borrow to the MutableFilter
instance
impl<'a, V, BF, F> Merger<V::Key, V, BF, F> where V: Mutable + 'a + Clone,
F: MutableFilter,
BF: BorrowMut<F>
[src]
F: MutableFilter,
BF: BorrowMut<F>
fn with_filter(v: V, f: BF) -> Self
Return a new Merger with the given initial value v
and the filter f
Trait Implementations
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>
[src]
K: Clone + Display,
F: MutableFilter,
BF: BorrowMut<F>
fn push<'b>(&mut self, k: &'b K)
... we recurse into the Value
at the given Key
. Read more
fn pop(&mut self)
... we have processed all items and leave the object previously push
ed.
fn removed<'b>(&mut self, k: &'b K, v: &'a V)
... the Value v
at the given Key k
should be removed. Read more
fn added<'b>(&mut self, k: &'b K, v: &'a V)
.. the Value v
at the given Key k
should be added. Read more
fn unchanged<'b>(&mut self, v: &'a V)
The Value v
was not changed.
fn modified<'b>(&mut self, old: &'a V, new: &'a V)
... the old
Value was modified, and is now the new
Value.
impl<K, V, BF, F> AsRef<V> for Merger<K, V, BF, F>
[src]
fn as_ref(&self) -> &V
Performs the conversion.
impl<'a, V> From<V> for Merger<V::Key, V, DefaultMutableFilter, DefaultMutableFilter> where V: Mutable + 'a + Clone
[src]
fn from(v: V) -> Self
Return a new merger with the given initial value v
, and the DefaultMutableFilter
.