pub struct DiagnosticBuilder { /* private fields */ }Expand description
Builder for Diagnostic. Use this rather than struct literal at
emission sites so future schema evolution doesn’t ripple through.
Implementations§
Source§impl DiagnosticBuilder
impl DiagnosticBuilder
Sourcepub fn new(
diagnostic_id: impl Into<String>,
severity: Severity,
location: Location,
message: impl Into<String>,
) -> Self
pub fn new( diagnostic_id: impl Into<String>, severity: Severity, location: Location, message: impl Into<String>, ) -> Self
Start building a diagnostic with the required minimum (id, severity, location, message).
Sourcepub fn expected(self, witness: TypeWitness) -> Self
pub fn expected(self, witness: TypeWitness) -> Self
Attach an expected type witness.
Sourcepub fn found(self, witness: TypeWitness) -> Self
pub fn found(self, witness: TypeWitness) -> Self
Attach a found type witness.
Sourcepub fn with_fix(self, fix: SuggestedFix) -> Self
pub fn with_fix(self, fix: SuggestedFix) -> Self
Append a suggested fix.
Sourcepub fn context_window(self, window: ContextWindow) -> Self
pub fn context_window(self, window: ContextWindow) -> Self
Attach a context window.
Sourcepub fn rule(self, rule: impl Into<String>) -> Self
pub fn rule(self, rule: impl Into<String>) -> Self
Attach a rule citation ("ADR-006-§1.1" etc.).
Sourcepub fn with_note(self, note: DiagnosticNote) -> Self
pub fn with_note(self, note: DiagnosticNote) -> Self
Append an auxiliary note.
Sourcepub fn build(self) -> Diagnostic
pub fn build(self) -> Diagnostic
Finalize.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiagnosticBuilder
impl RefUnwindSafe for DiagnosticBuilder
impl Send for DiagnosticBuilder
impl Sync for DiagnosticBuilder
impl Unpin for DiagnosticBuilder
impl UnsafeUnpin for DiagnosticBuilder
impl UnwindSafe for DiagnosticBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more