pub struct Diagnostic {
pub severity: DiagnosticSeverity,
pub code: DiagnosticCode,
pub message: String,
pub target: DiagnosticTarget,
pub source: Option<SourceSpan>,
pub snippet: Option<String>,
}Expand description
Structured diagnostic emitted while building a parsed document.
Fields§
§severity: DiagnosticSeverityDiagnostic severity.
code: DiagnosticCodeStable machine-readable code.
message: StringHuman-readable message.
target: DiagnosticTargetBibliography object targeted by this diagnostic.
source: Option<SourceSpan>Source location, when available.
snippet: Option<String>Short source context suitable for display, when available.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn error(
code: DiagnosticCode,
message: impl Into<String>,
target: DiagnosticTarget,
source: Option<SourceSpan>,
) -> Self
pub fn error( code: DiagnosticCode, message: impl Into<String>, target: DiagnosticTarget, source: Option<SourceSpan>, ) -> Self
Create an error diagnostic.
Sourcepub fn with_snippet(self, snippet: impl Into<String>) -> Self
pub fn with_snippet(self, snippet: impl Into<String>) -> Self
Attach source context to this diagnostic.
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 (const: unstable) · 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 PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for Diagnostic
impl StructuralPartialEq 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
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