Trait treediff::tools::MutableFilter

source ·
pub trait MutableFilter {
    // Provided methods
    fn resolve_conflict<'a, K: Clone + Display, V: Clone>(
        &mut self,
        _keys: &[K],
        _old: &'a V,
        new: &'a V,
        _target: &mut V
    ) -> Option<Cow<'a, V>> { ... }
    fn resolve_removal<'a, K: Clone + Display, V: Clone>(
        &mut self,
        _keys: &[K],
        _removed: &'a V,
        _target: &mut V
    ) -> Option<Cow<'a, V>> { ... }
}
Expand description

A filter to manipulate calls to be made to Values implementing the Mutable trait in calls made by the Merger Delegate.

This allows you to control the exact way merge operations are performed independently of the type implementing the Value trait, which usually is not under your control.

Provided Methods§

source

fn resolve_conflict<'a, K: Clone + Display, V: Clone>( &mut self, _keys: &[K], _old: &'a V, new: &'a V, _target: &mut V ) -> Option<Cow<'a, V>>

Called during Delegate::modified(...), returns None to cause the Value at the keys to be removed, or any Value to be set in its place.

old is the previous value at the given keys path, and new is the one now at its place. _target provides access to the target of the merge operation.

source

fn resolve_removal<'a, K: Clone + Display, V: Clone>( &mut self, _keys: &[K], _removed: &'a V, _target: &mut V ) -> Option<Cow<'a, V>>

Called during Delegate::removed(...), returns None to allow the Value at the keys path to be removed, or any Value to be set in its place instead.

removed is the Value which is to be removed. _target provides access to the target of the merge operation.

Object Safety§

This trait is not object safe.

Implementors§