#[non_exhaustive]pub struct Warning<'src> {
pub source: Span<'src>,
pub warning: WarningType,
pub severity: WarningSeverity,
pub origin: Option<SourceLine>,
}Expand description
Describes a possible parse error (i.e. a “warning”) and its location.
In asciidoc-parser, all documents are parseable, so this mechanism is used
to convey conditions where the parse result might be unexpected.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source: Span<'src>Location where the warning was detected.
warning: WarningTypeType of warning detected.
severity: WarningSeveritySeverity of this warning.
This is derived from warning – each WarningType
has a fixed severity – so a host can filter the
Document::warnings stream by
importance without matching on every individual type. Most diagnostics
are WarningSeverity::Warning; a handful (such as an unknown block
style) are WarningSeverity::Debug, which a host suppresses by
default.
origin: Option<SourceLine>A pre-resolved originating (file, line) for this warning, independent
of the document source map.
This is None for the overwhelming majority of warnings: their
source span indexes the (preprocessed) document
source, so the originating file and line are recovered by resolving
source.line() through Document::source_map.
It is Some only when the warning arises from content that was expanded
privately and never appears in the document source – an include::
directive buried inside an owned (include-expanded) AsciiDoc table cell.
No document span maps to such a directive, so its true (file, line) is
resolved when the warning is raised (against the owning cell’s own
source map) and carried here directly. In that case source still
points at the enclosing cell’s directive line in the document (a
best-effort anchor), but origin names where the failing directive
actually lives.