pub struct Diagnostics { /* private fields */ }Expand description
Accumulator for compile-pipeline diagnostics.
Each stage in merge → expand → analyze → lower → validate runs
per-rule / per-node “leaf checks” against the input. Historically
every leaf check used ? to early-return, which meant an operator
running vane compile <dir> only ever saw the first error: fix
that, re-run, see the next, fix that, re-run, etc. With
Diagnostics, leaf checks push instead of ?-returning and the
stage boundary decides whether to bail with the full accumulator
or continue into the next stage.
Every entry currently has the same severity (compile error). The
has_fatal helper exists so callers can express the “any error
stops the next stage” gate clearly at stage boundaries; future
warning-level diagnostics would slot in without changing call
sites.
Implementations§
Source§impl Diagnostics
impl Diagnostics
pub const fn new() -> Self
pub fn push(&mut self, e: Error)
pub fn extend<I: IntoIterator<Item = Error>>(&mut self, iter: I)
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn has_fatal(&self) -> bool
pub fn has_fatal(&self) -> bool
True when the accumulator carries at least one error that
should stop the pipeline at the next stage boundary. Equivalent
to !is_empty() today; reserved as a hook for warning-level
diagnostics that might land here in the future.
pub fn entries(&self) -> &[Error]
pub fn into_errors(self) -> Vec<Error>
Sourcepub fn into_result<T>(self, value: T) -> Result<T, Self>
pub fn into_result<T>(self, value: T) -> Result<T, Self>
Stage-boundary gate. Returns Ok(value) when no diagnostics
have been pushed; otherwise returns Err(Self) so the caller
can either bubble or merge it into another accumulator.
§Errors
Returns self when has_fatal() is true.
Trait Implementations§
Source§impl Debug for Diagnostics
impl Debug for Diagnostics
Source§impl Default for Diagnostics
impl Default for Diagnostics
Source§fn default() -> Diagnostics
fn default() -> Diagnostics
Source§impl Display for Diagnostics
impl Display for Diagnostics
Source§impl From<Diagnostics> for Error
Collapse the accumulated diagnostics into a single
ErrorKind::Compile Error whose context carries every entry’s
to_string(), separated by \n. Used at the boundary into APIs
whose error channel is a single Error (e.g. the existing
compile() facade, the management-RPC wire payload).
impl From<Diagnostics> for Error
Collapse the accumulated diagnostics into a single
ErrorKind::Compile Error whose context carries every entry’s
to_string(), separated by \n. Used at the boundary into APIs
whose error channel is a single Error (e.g. the existing
compile() facade, the management-RPC wire payload).