pub struct ProcessorInput<'a> {
pub options: &'a MultiSourceOptions,
pub meta: &'a Value,
pub parser: &'a Arc<Tabnas>,
pub depth: usize,
}Expand description
What a Processor is given.
The canonical TypeScript hands a processor the whole parse
Context, of which processors read only ctx.meta, plus the
instance. Narrowing it keeps a processor callable, and therefore
testable, outside a parse.
Fields§
§options: &'a MultiSourceOptionsThe plugin options in force for this parse.
meta: &'a ValueThe metadata for this load. multisource.path names the source
being processed, which is how a relative reference inside it
resolves against its own directory.
parser: &'a Arc<Tabnas>The parser the document is being read by, for a processor that re-parses its source.
depth: usizeHow many sources enclose this one. Zero for a reference in the
document the caller handed to parse.
Implementations§
Source§impl ProcessorInput<'_>
impl ProcessorInput<'_>
Sourcepub fn parse_source(&self, src: &str) -> Result<Value, TabnasError>
pub fn parse_source(&self, src: &str) -> Result<Value, TabnasError>
Re-parse src as a nested source of this load.
Use this rather than calling the parser directly: it threads the
metadata through, so a relative reference inside src resolves
against this source’s own directory, and it keeps the chain off
one stack. See parse_nested.