Struct wasm_bindgen_backend::Diagnostic
source · 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 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.