pub struct StructuredParseError {
pub kind: ParseErrorKind,
pub location: SourceLocation,
pub span_end: Option<(usize, usize)>,
pub source_context: SourceContext,
pub suggestions: Vec<Suggestion>,
pub related: Vec<RelatedInfo>,
pub severity: ErrorSeverity,
pub code: ErrorCode,
}Expand description
A complete structured parse error with all context needed for rendering
Fields§
§kind: ParseErrorKindThe specific error kind
location: SourceLocationPrimary location of the error
span_end: Option<(usize, usize)>Optional span end for range errors
source_context: SourceContextThe source code snippet around the error
suggestions: Vec<Suggestion>Computed suggestions based on error kind
Related locations (e.g., where a brace was opened)
severity: ErrorSeverityError severity
code: ErrorCodeError code for documentation lookup
Implementations§
Source§impl StructuredParseError
impl StructuredParseError
pub fn new(kind: ParseErrorKind, location: SourceLocation) -> Self
pub fn with_span_end(self, line: usize, col: usize) -> Self
pub fn with_source_context(self, ctx: SourceContext) -> Self
pub fn with_suggestion(self, suggestion: Suggestion) -> Self
pub fn with_suggestions( self, suggestions: impl IntoIterator<Item = Suggestion>, ) -> Self
pub fn with_severity(self, severity: ErrorSeverity) -> Self
pub fn with_code(self, code: ErrorCode) -> Self
Trait Implementations§
Source§impl Clone for StructuredParseError
impl Clone for StructuredParseError
Source§fn clone(&self) -> StructuredParseError
fn clone(&self) -> StructuredParseError
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 StructuredParseError
impl Debug for StructuredParseError
Source§impl Display for StructuredParseError
impl Display for StructuredParseError
Source§impl Error for StructuredParseError
impl Error for StructuredParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for StructuredParseError
impl RefUnwindSafe for StructuredParseError
impl Send for StructuredParseError
impl Sync for StructuredParseError
impl Unpin for StructuredParseError
impl UnsafeUnpin for StructuredParseError
impl UnwindSafe for StructuredParseError
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