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, ) -> StructuredParseError
pub fn with_span_end(self, line: usize, col: usize) -> StructuredParseError
pub fn with_source_context(self, ctx: SourceContext) -> StructuredParseError
pub fn with_suggestion(self, suggestion: Suggestion) -> StructuredParseError
pub fn with_suggestions( self, suggestions: impl IntoIterator<Item = Suggestion>, ) -> StructuredParseError
pub fn with_severity(self, severity: ErrorSeverity) -> StructuredParseError
pub fn with_code(self, code: ErrorCode) -> StructuredParseError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.