pub trait Comparator: Send + Sync {
// Required methods
fn descriptor(&self) -> ComparatorDescriptor;
fn compare(
&self,
pair: &ItemPair,
data: &dyn DataAccess,
) -> BinocResult<CompareResult>;
// Provided methods
fn reopen(
&self,
_pair: &ItemPair,
_child_path: &str,
_data: &dyn DataAccess,
) -> BinocResult<ItemPair> { ... }
fn extract(
&self,
_node: &DiffNode,
_aspect: &str,
_data: &dyn DataAccess,
) -> Option<ExtractResult> { ... }
}Expand description
A plugin that claims an item pair and either emits a leaf diff or expands the pair into child items for further processing.
Routing is fully declarative via ComparatorDescriptor. If the
descriptor matches but the comparator discovers at compare-time that
it cannot handle the item, it returns CompareResult::Skip.
Required Methods§
fn descriptor(&self) -> ComparatorDescriptor
fn compare( &self, pair: &ItemPair, data: &dyn DataAccess, ) -> BinocResult<CompareResult>
Provided Methods§
Sourcefn reopen(
&self,
_pair: &ItemPair,
_child_path: &str,
_data: &dyn DataAccess,
) -> BinocResult<ItemPair>
fn reopen( &self, _pair: &ItemPair, _child_path: &str, _data: &dyn DataAccess, ) -> BinocResult<ItemPair>
Reconstruct physical access to a child item without re-diffing.
Container comparators (zip, directory, tar) override this to
extract or resolve a child path within the container, returning
an ItemPair that downstream comparators can work with.
Used by the extract chain: the controller walks ancestor nodes
calling reopen() to progressively reconstruct the scratchpad.
Sourcefn extract(
&self,
_node: &DiffNode,
_aspect: &str,
_data: &dyn DataAccess,
) -> Option<ExtractResult>
fn extract( &self, _node: &DiffNode, _aspect: &str, _data: &dyn DataAccess, ) -> Option<ExtractResult>
Extract user-facing data from a node this comparator produced.