pub struct Diagnostic {
pub severity: Severity,
pub code: Option<String>,
pub message: String,
pub primary: Option<Location>,
pub related: Vec<Location>,
pub hint: Option<String>,
}Expand description
Structured diagnostic information
Fields§
§severity: SeverityError severity level
code: Option<String>Optional error code (e.g., “E001”, “typst::syntax”)
message: StringHuman-readable error message
primary: Option<Location>Primary source location
Related source locations for context
hint: Option<String>Optional hint for fixing the error
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn with_location(self, location: Location) -> Self
pub fn with_location(self, location: Location) -> Self
Set the primary location
Add a related location
Sourcepub fn fmt_pretty(&self) -> String
pub fn fmt_pretty(&self) -> String
Format diagnostic for pretty printing
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
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin 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