pub struct Diagnostic { /* private fields */ }
Expand description
A struct representing a diagnostic to emit to the end-user as an error.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn error<T: Into<String>>(text: T) -> Diagnostic
pub fn error<T: Into<String>>(text: T) -> Diagnostic
Generate a Diagnostic
from an informational message with no Span
Sourcepub fn span_error<T: Into<String>>(span: Span, text: T) -> Diagnostic
pub fn span_error<T: Into<String>>(span: Span, text: T) -> Diagnostic
Generate a Diagnostic
from a Span and an informational message
Sourcepub fn spanned_error<T: Into<String>>(
node: &dyn ToTokens,
text: T,
) -> Diagnostic
pub fn spanned_error<T: Into<String>>( node: &dyn ToTokens, text: T, ) -> Diagnostic
Generate a Diagnostic
from the span of any tokenizable object and a message
Sourcepub fn from_vec(diagnostics: Vec<Diagnostic>) -> Result<(), Diagnostic>
pub fn from_vec(diagnostics: Vec<Diagnostic>) -> Result<(), Diagnostic>
Attempt to generate a Diagnostic
from a vector of other Diagnostic
instances.
If the Vec
is empty, returns Ok(())
, otherwise returns the new Diagnostic
Trait Implementations§
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl From<Error> for Diagnostic
impl From<Error> for Diagnostic
Source§fn from(err: Error) -> Diagnostic
fn from(err: Error) -> Diagnostic
Converts to this type from the input type.
Source§impl ToTokens for Diagnostic
impl ToTokens for Diagnostic
Source§fn to_tokens(&self, dst: &mut TokenStream)
fn to_tokens(&self, dst: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin 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
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.