OutputSink

Trait OutputSink 

Source
pub trait OutputSink {
    // Required methods
    fn sink(&mut self, chunk: &str);
    fn sink_source_mapped(&mut self, source_mapped_chunk: SourceMappedChunk<'_>);
}
Expand description

Trait implemented by types into which the preprocessor may sink its output.

The preprocessor outputs chunk of text, that when concatenated in order represent the intended output string of the preprocessor.

Most chunks sunk by the preprocessor can be mapped to a source text-span within a file in the filesystem. In this case the preprocessor will call OutputSink::sink_source_mapped to sink the text-chunk, along with information identifying the source text-span.

The preprocessor may generate some chunks that cannot be mapped to a source text-span. If this is the case, preprocessor will call OutputSink::sink to the text-chunk, without any additional information.

See also the Custom OutputSink section of the top-level documentation.

Required Methods§

Source

fn sink(&mut self, chunk: &str)

Called with chunks that cannot be mapped to a source span.

Source

fn sink_source_mapped(&mut self, source_mapped_chunk: SourceMappedChunk<'_>)

Called with chunks that can be mapped to a source span.

Implementations on Foreign Types§

Source§

impl OutputSink for String

Source§

fn sink(&mut self, chunk: &str)

Source§

fn sink_source_mapped(&mut self, source_mapped_chunk: SourceMappedChunk<'_>)

Implementors§