pub struct Diagnostic {
pub severity: Severity,
pub code: Option<Atom>,
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: Severity§code: Option<Atom>What it is: one of yog_ids’ problem codes (YD0001, YB0002), or
the tool’s own (E0308, a lint’s name); none until it’s known.
message: String§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>§end_line: Option<u32>§end_col: Option<u32>§tool: Option<Atom>Who found it, when not Yog itself (rustc, cargo).
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn error(code: &str, message: impl Display) -> Diagnostic
pub fn error(code: &str, message: impl Display) -> Diagnostic
An error of kind code.
Sourcepub fn warning(code: &str, message: impl Display) -> Diagnostic
pub fn warning(code: &str, message: impl Display) -> Diagnostic
A warning of kind code.
pub fn of(severity: Severity, code: &str, message: impl Display) -> Diagnostic
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: &str) -> Diagnostic
pub fn by(self, tool: &str) -> Diagnostic
Found by tool.
Sourcepub fn or_code(self, code: &str) -> Diagnostic
pub fn or_code(self, code: &str) -> Diagnostic
Of kind code when its kind isn’t known yet (it was met as plain text).
Sourcepub fn map(self, wrap: impl FnOnce(String) -> String) -> Diagnostic
pub fn map(self, wrap: impl FnOnce(String) -> String) -> Diagnostic
Its message wrapped (<Slot> {e}), the rest kept.
pub fn is_error(&self) -> bool
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 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, __yog_w: &mut Writer)
fn encode(&self, __yog_w: &mut Writer)
Schema::write’s
value encoded, unless the type knows better (derived ones do).Source§fn decode(__yog_d: &mut Decoder<'_>) -> Option<Diagnostic>
fn decode(__yog_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, __yog_p: &mut Packer)
fn pack(&self, __yog_p: &mut Packer)
crate::frame): its binary form as
bytes, unless the type packs itself (derived ones and plain types do).Source§fn unpack(__yog_u: &mut Unpacker<'_>) -> Option<Diagnostic>
fn unpack(__yog_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.Source§fn pack_list(items: &[Self], p: &mut Packer)
fn pack_list(items: &[Self], p: &mut Packer)
Source§fn encode_list(items: &[Self], w: &mut Writer)
fn encode_list(items: &[Self], w: &mut Writer)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Message for Twhere
T: Schema,
impl<T> Message for Twhere
T: Schema,
Source§fn from_bytes(bytes: &[u8]) -> Option<Self>
fn from_bytes(bytes: &[u8]) -> Option<Self>
None if it isn’t one.Source§fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
f on the payload, packed in this thread’s reused buffers: nothing
allocated once they’ve grown to the thread’s messages.