Skip to main content

Expander

Trait Expander 

Source
pub trait Expander {
    // Required methods
    fn push(
        &mut self,
        line: Line,
        info: MatchInfo,
        out: &mut dyn FnMut(EmitOwned),
    );
    fn drain(&mut self, out: &mut dyn FnMut(EmitOwned));
}
Expand description

An expander consumes (Line, MatchInfo) pairs and produces Emits.

The expander owns the line and match info until it emits them, because it may need to buffer lines as context.

Required Methods§

Source

fn push(&mut self, line: Line, info: MatchInfo, out: &mut dyn FnMut(EmitOwned))

Feed the next line/match pair. Call drain() after EOF to flush remaining context.

Source

fn drain(&mut self, out: &mut dyn FnMut(EmitOwned))

Called once at EOF to flush any buffered trailing context.

Implementors§