pub struct Diagnostic {
pub severity: Severity,
pub code: Option<Code>,
pub message: String,
pub file: Option<Atom>,
pub path: Path,
pub on_key: bool,
pub line: Option<u32>,
pub col: Option<u32>,
pub end_line: Option<u32>,
pub end_col: Option<u32>,
pub tool: Option<Atom>,
}Expand description
One thing found.
Fields§
§severity: SeverityHow bad it is.
code: Option<Code>What it is: one of this crate’s Problems (SD0001) or a
tool’s own code (E0308, a lint’s name); none until it’s known.
message: StringWhat’s wrong, for a person.
file: Option<Atom>The file it’s in.
path: PathThe value it’s about, in its document (entries[2].icon).
on_key: boolAbout the key at path rather than its value (an unknown field).
line: Option<u32>1-based.
col: Option<u32>Its 1-based column, when known.
end_line: Option<u32>The line it ends on, when known.
end_col: Option<u32>The column it ends at, when known.
tool: Option<Atom>Who found it, when not the tool itself (rustc, cargo).
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn of(
severity: Severity,
code: impl Into<Code>,
message: impl Display,
) -> Self
pub fn of( severity: Severity, code: impl Into<Code>, message: impl Display, ) -> Self
A diagnostic of severity, code and message, not yet placed.
Sourcepub fn syntax(e: SyntaxError) -> Self
pub fn syntax(e: SyntaxError) -> Self
Text that doesn’t parse, where it stops.
Sourcepub fn or_code(self, code: impl Into<Code>) -> Self
pub fn or_code(self, code: impl Into<Code>) -> Self
Of kind code when its kind isn’t known yet (it was met as plain text).
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Default for Diagnostic
impl Default for Diagnostic
Source§impl Display for Diagnostic
As text: file:line:col: path: message, each part when it’s known.
impl Display for Diagnostic
As text: file:line:col: path: message, each part when it’s known.
impl Eq for Diagnostic
Source§impl Error for Diagnostic
impl Error for Diagnostic
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Fields for Diagnostic
impl Fields for Diagnostic
Source§impl From<&str> for Diagnostic
impl From<&str> for Diagnostic
Source§impl From<Diagnostic> for String
As text, for what says errors as text.
impl From<Diagnostic> for String
As text, for what says errors as text.
Source§fn from(d: Diagnostic) -> Self
fn from(d: Diagnostic) -> Self
Source§impl From<String> for Diagnostic
An error met as plain text: its kind not known yet (Diagnostic::or_code).
impl From<String> for Diagnostic
An error met as plain text: its kind not known yet (Diagnostic::or_code).
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§impl Schema for Diagnostic
impl Schema for Diagnostic
Source§fn encode(&self, __sd_w: &mut Writer)
fn encode(&self, __sd_w: &mut Writer)
Schema::write’s
value encoded, unless the type knows better (derived ones do).Source§fn decode(__sd_d: &mut Decoder<'_>) -> Option<Self>
fn decode(__sd_d: &mut Decoder<'_>) -> Option<Self>
None when it isn’t
what Schema::encode writes — then read_bytes reads the slow
way, which says what’s wrong. Through a value unless the type knows
better (derived ones do).Source§fn pack(&self, __sd_p: &mut Packer)
fn pack(&self, __sd_p: &mut Packer)
crate::frame): its binary form as
bytes, unless the type packs itself (derived ones and plain types do).Source§fn unpack(__sd_u: &mut Unpacker<'_>) -> Option<Self>
fn unpack(__sd_u: &mut Unpacker<'_>) -> Option<Self>
None if the bytes aren’t what
Schema::pack writes.Source§fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<Self>
fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<Self>
v. Problems go to cx at its current path; None when the
value couldn’t be read (the problem is in cx).Source§fn absent() -> Option<Self>
fn absent() -> Option<Self>
None: the field is required.