pub struct DiagnosticBuilder { /* private fields */ }Expand description
Builder for constructing Diagnostic instances.
All methods are builder-pattern (consume and return Self).
Call build to finalize into an immutable Diagnostic.
Implementations§
Source§impl DiagnosticBuilder
impl DiagnosticBuilder
Sourcepub fn level(self, level: Level) -> DiagnosticBuilder
pub fn level(self, level: Level) -> DiagnosticBuilder
Sets the severity level.
Sourcepub fn message(self, msg: impl Into<String>) -> DiagnosticBuilder
pub fn message(self, msg: impl Into<String>) -> DiagnosticBuilder
Sets the diagnostic message.
Sourcepub fn span(self, spans: impl MultiSpan) -> DiagnosticBuilder
pub fn span(self, spans: impl MultiSpan) -> DiagnosticBuilder
Sets the source span(s). Accepts a Span, Vec<Span>, or &[Span].
Sourcepub fn add(self, child: impl Into<DiagnosticBuilder>) -> DiagnosticBuilder
pub fn add(self, child: impl Into<DiagnosticBuilder>) -> DiagnosticBuilder
Adds a child diagnostic. Accepts a DiagnosticBuilder (built automatically)
or a Diagnostic (via Into<DiagnosticBuilder>).
Sourcepub fn build(self) -> Diagnostic
pub fn build(self) -> Diagnostic
Finalizes the builder into an immutable Diagnostic.
Trait Implementations§
Source§impl Clone for DiagnosticBuilder
impl Clone for DiagnosticBuilder
Source§fn clone(&self) -> DiagnosticBuilder
fn clone(&self) -> DiagnosticBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiagnosticBuilder
impl Debug for DiagnosticBuilder
Source§impl Default for DiagnosticBuilder
impl Default for DiagnosticBuilder
Source§fn default() -> DiagnosticBuilder
fn default() -> DiagnosticBuilder
Returns the “default value” for a type. Read more
Source§impl From<Diagnostic> for DiagnosticBuilder
impl From<Diagnostic> for DiagnosticBuilder
Source§fn from(d: Diagnostic) -> DiagnosticBuilder
fn from(d: Diagnostic) -> DiagnosticBuilder
Converts to this type from the input type.
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