Skip to main content

ParserRegistry

Struct ParserRegistry 

Source
pub struct ParserRegistry { /* private fields */ }
Expand description

The active set of parsers. Feeds each line to every parser and concatenates their entries. The Vec<Box<dyn CompilationParser>> is the extensibility seam: built-in parsers, plus (CM.6) WASM-contributed ones — a plugin implementing the error-parser world is registered here as one more Box<dyn CompilationParser> and is indistinguishable from a native parser downstream.

Implementations§

Source§

impl ParserRegistry

Source

pub fn new() -> Self

An empty registry (no parsers). Prefer Self::with_builtins.

Source

pub fn with_builtins() -> Self

The default registry: the built-in cargo/rustc (multi-line) + gnu-style (single-line) parsers.

Source

pub fn register(&mut self, parser: Box<dyn CompilationParser>)

Add a parser to the active set. Order is preserved; each line is fed to parsers in registration order.

CM.6: plugin parsers register before Self::with_builtins’s catch-all would claim a line, but after the format-specific natives. The dedup in Self::feed is first-entry-wins per location, so a plugin that recognises a line rustc also recognises does not displace rustc’s richer entry — and a line only the plugin understands is still its own.

Source

pub fn register_before_catch_all(&mut self, parser: Box<dyn CompilationParser>)

CM.6: register a plugin parser, placed ahead of the catch-all.

with_builtins ends with GeneralParser, whose job is to salvage a file:line:col out of anything. If a plugin registered after it, the catch-all’s thin Info entry would win the dedup for every location the plugin also matched, and the plugin’s severity and message would be silently discarded — the plugin would look like it did nothing.

Source

pub fn feed(&mut self, line: &str) -> Vec<ErrorEntry>

Feed one line to every registered parser and concatenate the entries they complete. Deduplicates by (path, line, col) — the FIRST entry for each location wins. Format-specific parsers register first and produce richer metadata (severity, message); the catch-all [crate::parsers::GeneralParser] registers last and its Info/empty duplicates are silently dropped.

Trait Implementations§

Source§

impl Default for ParserRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more