Struct Diagnostic

pub struct Diagnostic { pub(in ::diagnostic) level: Level, pub(in ::diagnostic) message: String, pub(in ::diagnostic) spans: Vec<Span>, pub(in ::diagnostic) children: Vec<Diagnostic> }

A structure representing a diagnostic message and associated children messages.

Fields

level: Level
message: String
spans: Vec<Span>
children: Vec<Diagnostic>

Implementations

impl Diagnostic

fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic

Creates a new diagnostic with the given level and message.

fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic
where
    S: MultiSpan,
    T: Into<String>,

Creates a new diagnostic with the given level and message pointing to the given set of spans.

fn span_error<S, T>(self, spans: S, message: T) -> Diagnostic
where
    S: MultiSpan,
    T: Into<String>,

Adds a new child diagnostics message to self with the Level::Error level, and the given spans and message.

fn error<T: Into<String>>(self, message: T) -> Diagnostic

Adds a new child diagnostic message to self with the Level::Error level, and the given message.

fn span_warning<S, T>(self, spans: S, message: T) -> Diagnostic
where
    S: MultiSpan,
    T: Into<String>,

Adds a new child diagnostics message to self with the Level::Warning level, and the given spans and message.

fn warning<T: Into<String>>(self, message: T) -> Diagnostic

Adds a new child diagnostic message to self with the Level::Warning level, and the given message.

fn span_note<S, T>(self, spans: S, message: T) -> Diagnostic
where
    S: MultiSpan,
    T: Into<String>,

Adds a new child diagnostics message to self with the Level::Note level, and the given spans and message.

fn note<T: Into<String>>(self, message: T) -> Diagnostic

Adds a new child diagnostic message to self with the Level::Note level, and the given message.

fn span_help<S, T>(self, spans: S, message: T) -> Diagnostic
where
    S: MultiSpan,
    T: Into<String>,

Adds a new child diagnostics message to self with the Level::Help level, and the given spans and message.

fn help<T: Into<String>>(self, message: T) -> Diagnostic

Adds a new child diagnostic message to self with the Level::Help level, and the given message.

fn level(&self) -> Level

Returns the diagnostic level for self.

fn set_level(&mut self, level: Level)

Sets the level in self to level.

fn message(&self) -> &str

Returns the message in self.

fn set_message<T: Into<String>>(&mut self, message: T)

Sets the message in self to message.

fn spans(&self) -> &[Span]

Returns the Spans in self.

fn set_spans<S: MultiSpan>(&mut self, spans: S)

Sets the Spans in self to spans.

fn children(&self) -> Children<'_>

Returns an iterator over the children diagnostics of self.

fn emit(self)

Emit the diagnostic.

Trait Implementations

impl Clone for Diagnostic

fn clone(&self) -> Diagnostic

impl Debug for Diagnostic

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

Auto Trait Implementations

impl !Send for Diagnostic

impl !Sync for Diagnostic

impl Freeze for Diagnostic

impl RefUnwindSafe for Diagnostic

impl Unpin for Diagnostic

impl UnsafeUnpin for Diagnostic

impl UnwindSafe for Diagnostic

Blanket Implementations

impl<T> Any for Diagnostic where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Diagnostic where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Diagnostic where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Diagnostic where T: Clone,

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

impl<T> From<T> for Diagnostic

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Diagnostic where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Diagnostic

impl<T> ToOwned for Diagnostic where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Diagnostic where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Diagnostic where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>