pub struct RustcDiagnostic {
pub message: String,
pub code: Option<RustcCode>,
pub level: String,
pub spans: Vec<RustcSpan>,
pub children: Vec<RustcDiagnostic>,
pub rendered: Option<String>,
}Expand description
A diagnostic message from rustc
Fields§
§message: StringThe main error message
code: Option<RustcCode>Optional error code (e.g., E0425)
level: StringSeverity level: “error”, “warning”, “note”, “help”
spans: Vec<RustcSpan>Source code spans where the error occurred
children: Vec<RustcDiagnostic>Child diagnostics (notes, suggestions)
rendered: Option<String>Rendered text output (optional)
Implementations§
Source§impl RustcDiagnostic
impl RustcDiagnostic
Sourcepub fn from_json_lines(json_lines: &str) -> Result<Vec<Self>, Error>
pub fn from_json_lines(json_lines: &str) -> Result<Vec<Self>, Error>
Parse multiple diagnostics from JSON lines
Sourcepub fn primary_span(&self) -> Option<&RustcSpan>
pub fn primary_span(&self) -> Option<&RustcSpan>
Get the primary span (the main location of the error)
Sourcepub fn primary_position(&self) -> Option<(String, usize, usize)>
pub fn primary_position(&self) -> Option<(String, usize, usize)>
Get the primary position as (file, line, column)
Sourcepub fn is_warning(&self) -> bool
pub fn is_warning(&self) -> bool
Check if this is a warning
Trait Implementations§
Source§impl Clone for RustcDiagnostic
impl Clone for RustcDiagnostic
Source§fn clone(&self) -> RustcDiagnostic
fn clone(&self) -> RustcDiagnostic
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 RustcDiagnostic
impl Debug for RustcDiagnostic
Source§impl<'de> Deserialize<'de> for RustcDiagnostic
impl<'de> Deserialize<'de> for RustcDiagnostic
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RustcDiagnostic
impl PartialEq for RustcDiagnostic
impl Eq for RustcDiagnostic
impl StructuralPartialEq for RustcDiagnostic
Auto Trait Implementations§
impl Freeze for RustcDiagnostic
impl RefUnwindSafe for RustcDiagnostic
impl Send for RustcDiagnostic
impl Sync for RustcDiagnostic
impl Unpin for RustcDiagnostic
impl UnwindSafe for RustcDiagnostic
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