Skip to main content

ParseRule

Trait ParseRule 

Source
pub trait ParseRule: Send + Sync {
    // Required methods
    fn descriptor(&self) -> ParseDescriptor;
    fn parse(
        &self,
        item: &ItemRef,
        data: &dyn DataAccess,
    ) -> BinocResult<ParseOutput>;

    // Provided methods
    fn extra_members(&self) -> Vec<MemberMatch> { ... }
    fn correlation(&self) -> Correlation { ... }
    fn parse_group(
        &self,
        group: &ParseGroup,
        data: &dyn DataAccess,
    ) -> BinocResult<ParseOutput> { ... }
}

Required Methods§

Source

fn descriptor(&self) -> ParseDescriptor

Source

fn parse( &self, item: &ItemRef, data: &dyn DataAccess, ) -> BinocResult<ParseOutput>

Parse a single anchor node. This is the single-input entry point every ordinary parser implements; the member-set generalization (CFM-83) does not touch it.

Provided Methods§

Source

fn extra_members(&self) -> Vec<MemberMatch>

Additional member slots beyond the anchor (descriptor().input), in order — e.g. .shx, .dbf, .prj, .cpg for a fusing shapefile claim. The default is empty: a single-input claim. The full ordered member-set is the anchor (always a required size-1 member) followed by these; see member_set.

Source

fn correlation(&self) -> Correlation

How candidate sibling groups are enumerated for a multi-input claim. Ignored when extra_members is empty.

Source

fn parse_group( &self, group: &ParseGroup, data: &dyn DataAccess, ) -> BinocResult<ParseOutput>

Parse a resolved correlated member group. The default delegates to parse on the anchor, so single-input rules need not implement it. A fusing rule (e.g. the shapefile layer) overrides this to read its .shp/.dbf/.prj members together and emit one fused node; it returns an empty ParseOutput to decline when the group is not a real instance of its format, releasing the members to smaller claims.

Implementors§