Skip to main content

CompactionRule

Trait CompactionRule 

Source
pub trait CompactionRule: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn rewrite(
        &self,
        ctx: &LinkCtx<'_>,
        edits: &[Edit],
        data: &dyn DataAccess,
    ) -> BinocResult<Option<Vec<Edit>>>;

    // Provided method
    fn format(&self) -> Option<ArtifactFormat> { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn rewrite( &self, ctx: &LinkCtx<'_>, edits: &[Edit], data: &dyn DataAccess, ) -> BinocResult<Option<Vec<Edit>>>

Provided Methods§

Source

fn format(&self) -> Option<ArtifactFormat>

The artifact format whose provenance-scoped segment this rule rewrites. The dispatcher slices a link’s merged edit list down to the edits tagged with this format before calling rewrite, so a rule never sees or rewrites another content type’s edits. None means the rule operates on the whole (unsegmented) edit list — reserved for cross-content-type or structural compaction; format-specific rules must declare their format.

Implementors§