pub struct Diagnostic { /* private fields */ }Expand description
A compiler diagnostic (error, warning, note, or help message).
Immutable once built. Create instances via Builder or the
free functions in crate::mark.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn span(&self) -> Span
pub fn span(&self) -> Span
Returns the joined span of this diagnostic, or call_site if no spans are attached.
Sourcepub fn level(&self) -> Level
pub fn level(&self) -> Level
Returns the highest severity level among this diagnostic and its children.
pub fn iter(&self) -> impl Iterator<Item = &Self>
pub fn walk(&self) -> Walk<'_> ⓘ
Sourcepub fn is_error(&self) -> bool
pub fn is_error(&self) -> bool
Returns true if the highest severity level is Level::Error or above.
pub fn emit_as_item_tokens(self) -> TokenStream
pub fn emit_as_expr_tokens(self) -> TokenStream
Sourcepub fn emit(self) -> TokenStream
pub fn emit(self) -> TokenStream
Emits all accumulated diagnostics as compiler messages.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
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 Diagnostic
impl Debug for Diagnostic
Source§impl Default for Diagnostic
impl Default for Diagnostic
Source§fn default() -> Diagnostic
fn default() -> Diagnostic
Returns the “default value” for a type. Read more
Source§impl Display for Diagnostic
impl Display for Diagnostic
Source§impl From<Diagnostic> for Builder
impl From<Diagnostic> for Builder
Source§fn from(d: Diagnostic) -> Self
fn from(d: Diagnostic) -> Self
Converts to this type from the input type.
Source§impl From<Diagnostic> for Diagnostic
Available on crate feature diagnostics only.
impl From<Diagnostic> for Diagnostic
Available on crate feature
diagnostics only.Source§fn from(value: Diagnostic) -> Self
fn from(value: Diagnostic) -> Self
Converts to this type from the input type.
Source§impl From<Diagnostic> for Output
impl From<Diagnostic> for Output
Source§fn from(diagnostic: Diagnostic) -> Self
fn from(diagnostic: Diagnostic) -> Self
Converts to this type from the input type.
Source§impl From<Error> for Diagnostic
impl From<Error> for Diagnostic
Source§impl From<Output> for Diagnostic
impl From<Output> for Diagnostic
Source§impl<'a> IntoIterator for &'a Diagnostic
impl<'a> IntoIterator for &'a Diagnostic
Source§impl IntoIterator for Diagnostic
impl IntoIterator for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
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