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 error(code: impl Into<Code>, message: impl Display) -> Diagnostic
pub fn error(code: impl Into<Code>, message: impl Display) -> Diagnostic
An error of kind code.
Sourcepub fn warning(code: impl Into<Code>, message: impl Display) -> Diagnostic
pub fn warning(code: impl Into<Code>, message: impl Display) -> Diagnostic
A warning of kind code.
Sourcepub fn of(
severity: Severity,
code: impl Into<Code>,
message: impl Display,
) -> Diagnostic
pub fn of( severity: Severity, code: impl Into<Code>, message: impl Display, ) -> Diagnostic
A diagnostic of severity, code and message, not yet placed.
Sourcepub fn syntax(e: SyntaxError) -> Diagnostic
pub fn syntax(e: SyntaxError) -> Diagnostic
Text that doesn’t parse, where it stops.
Sourcepub fn in_file(self, file: impl Display) -> Diagnostic
pub fn in_file(self, file: impl Display) -> Diagnostic
In file.
Sourcepub fn at_line(self, line: usize) -> Diagnostic
pub fn at_line(self, line: usize) -> Diagnostic
At line of its file.
Sourcepub fn at(self, at: LineCol) -> Diagnostic
pub fn at(self, at: LineCol) -> Diagnostic
At at (a line and column) of its file.
Sourcepub fn at_path(self, path: Path) -> Diagnostic
pub fn at_path(self, path: Path) -> Diagnostic
About the value at path.
Sourcepub fn by(self, tool: Atom) -> Diagnostic
pub fn by(self, tool: Atom) -> Diagnostic
Found by tool.
Sourcepub fn or_code(self, code: impl Into<Code>) -> Diagnostic
pub fn or_code(self, code: impl Into<Code>) -> Diagnostic
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§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Default for Diagnostic
impl Default for Diagnostic
Source§fn default() -> Diagnostic
fn default() -> 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§fn from(message: &str) -> Diagnostic
fn from(message: &str) -> Diagnostic
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§fn from(message: String) -> Diagnostic
fn from(message: String) -> Diagnostic
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<Diagnostic>
fn decode(__sd_d: &mut Decoder<'_>) -> Option<Diagnostic>
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<Diagnostic>
fn unpack(__sd_u: &mut Unpacker<'_>) -> Option<Diagnostic>
None if the bytes aren’t what
Schema::pack writes.Source§fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<Diagnostic>
fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<Diagnostic>
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.