pub struct Diagnostic {
pub span: Option<Span>,
pub msg: String,
}Expand description
Fields§
§span: Option<Span>The source span associated with this diagnostic.
msg: StringThe message attached to this diagnostic.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(span: Option<Span>, msg: impl Display) -> Diagnostic
pub fn new(span: Option<Span>, msg: impl Display) -> Diagnostic
Constructs a diagnostic using any Display type as the source of the message.
Sourcepub fn default_global_emitter() -> &'static dyn Emitter
pub fn default_global_emitter() -> &'static dyn Emitter
Return a reference to the current default global Emitter.
This is the emitter used as the global emitter (returned by Diagnostic::emitter()) unless a call of Diagnostic::with() is ongoing in the current thread.
Sourcepub fn set_default_global_emitter(emitter: impl 'static + Send + Sync + Emitter)
pub fn set_default_global_emitter(emitter: impl 'static + Send + Sync + Emitter)
Set the default global Emitter.
This is the emitter used as the global emitter (returned by Diagnostic::emitter()) unless a call of Diagnostic::with() is ongoing in the current thread.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Emit for Diagnostic
impl Emit for Diagnostic
Source§fn emit(&self) -> DiagnosticEmitted
fn emit(&self) -> DiagnosticEmitted
Emit the object as a 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more