pub struct Diagnostic {
pub code: DiagnosticCode,
pub stage: &'static str,
pub declaration: Option<String>,
pub line: Option<usize>,
pub message: String,
/* private fields */
}Expand description
One typed, located diagnostic of a result.
Fields§
§code: DiagnosticCode§stage: &'static strThe receipt stage it concerns.
declaration: Option<String>The Lean declaration (dotted name) it concerns.
line: Option<usize>The 1-based line of the input it concerns.
message: StringImplementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(
stage: &'static str,
code: DiagnosticCode,
message: impl Into<String>,
) -> Self
pub fn new( stage: &'static str, code: DiagnosticCode, message: impl Into<String>, ) -> Self
A diagnostic of a classified code. An unclassified or usage code is an unsupported feature.
Sourcepub fn of_refusal(stage: &'static str, verdict: &Verdict) -> Self
pub fn of_refusal(stage: &'static str, verdict: &Verdict) -> Self
The diagnostic a refusal carries, with its location.
pub fn with_declaration(self, declaration: impl Into<String>) -> Self
pub fn with_line(self, line: usize) -> Self
Sourcepub fn outcome(&self) -> Outcome
pub fn outcome(&self) -> Outcome
The outcome this diagnostic decides when its stage is the first that did not pass.
pub fn to_json(&self) -> Value
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 PartialEq for Diagnostic
impl PartialEq for Diagnostic
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