Skip to main content

ParseDefect

Struct ParseDefect 

Source
pub struct ParseDefect {
    pub rule_id: String,
    pub message: String,
    pub span: SourceSpan,
    pub resource_id: Option<String>,
    pub property_path: Option<String>,
    pub phase: Option<DefectPhase>,
}
Expand description

A finding produced while parsing a template and building the semantic model.

Field semantics mirror the diagnostic they are converted into downstream: span is UNKNOWN_SPAN when no source location is known, and the optional anchors attribute the defect to a named template entity.

Fields§

§rule_id: String

Registry rule ID of the check this defect belongs to.

§message: String§span: SourceSpan

Source location, or UNKNOWN_SPAN when none has been resolved yet.

§resource_id: Option<String>

Logical ID of the resource (or output pseudo-resource) the defect is anchored to, when it targets one.

§property_path: Option<String>

Slash- or dot-separated path locating the defect within the template.

§phase: Option<DefectPhase>

Pipeline stage attribution; None lets downstream enrichment derive it.

Implementations§

Source§

impl ParseDefect

Source

pub fn new(rule_id: impl Into<String>, message: impl Into<String>) -> Self

Starts a defect for rule_id carrying message. All anchors default to absent and are added through the builder-style methods below.

Source

pub fn location(self, span: SourceSpan) -> Self

Sets the source span.

Source

pub fn resource(self, resource_id: impl Into<String>) -> Self

Anchors the defect to a resource logical ID. An empty ID is dropped so callers can pass through an ID that may be blank.

Source

pub fn property_path(self, property_path: impl Into<String>) -> Self

Records the property path. An empty path is ignored so callers can pass through a path that may be blank.

Source

pub fn phase(self, phase: DefectPhase) -> Self

Pins the pipeline stage the defect belongs to.

Source

pub fn is_fatal(&self) -> bool

Whether this defect represents a fatal structural failure. Built-in rule IDs encode severity in their prefix letter, and this crate assigns every parse rule ID, so the prefix is authoritative here.

Source

pub fn resource_logical_id(&self) -> Option<&str>

Logical ID of the resource the defect is anchored to, when it targets one.

Trait Implementations§

Source§

impl Clone for ParseDefect

Source§

fn clone(&self) -> ParseDefect

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseDefect

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ParseDefect

Source§

fn eq(&self, other: &ParseDefect) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParseDefect

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.