pub struct ParseError {
pub kind: ParseErrorKind,
pub failed_format: Option<&'static str>,
pub format_stack: Vec<&'static str>,
}Expand description
A minimal runtime parser failure.
Vest parsers work on progressively sliced inputs, so a globally meaningful byte offset is not available unless the caller explicitly threads that information through the parser stack. Instead, this error carries a coarse-grained failure kind plus the names of the DSL-defined formats on the failing path, when that information is available.
Fields§
§kind: ParseErrorKindThe kind of failure that occurred.
failed_format: Option<&'static str>The innermost named format known to have failed.
format_stack: Vec<&'static str>The named-format call stack that led to the failure, stored innermost-first.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub exec fn new(kind: ParseErrorKind) -> e : Self
pub exec fn new(kind: ParseErrorKind) -> e : Self
e.kind == kind,Creates a new parse error.
Sourcepub exec fn push_format(self, current_format: &'static str) -> Self
pub exec fn push_format(self, current_format: &'static str) -> Self
Pushes one named format onto the failing format stack.
The first pushed format becomes current_format, so current_format continues to refer to
the innermost failing named format even as outer formats append themselves during
propagation.
Sourcepub exec fn format_trace(&self) -> &[&'static str]
pub exec fn format_trace(&self) -> &[&'static str]
Returns the recorded format stack as an innermost-first slice.
Source§impl ParseError
impl ParseError
Sourcepub exec fn unexpected_eof() -> e : Self
pub exec fn unexpected_eof() -> e : Self
e.kind == ParseErrorKind::UnexpectedEof,Creates an unexpected end-of-input error.
Sourcepub exec fn expecting_eof() -> Self
pub exec fn expecting_eof() -> Self
Creates an expecting end-of-input error.
Sourcepub exec fn invalid_tag() -> Self
pub exec fn invalid_tag() -> Self
Creates an invalid-tag error.
Sourcepub exec fn invalid_choice() -> Self
pub exec fn invalid_choice() -> Self
Creates an invalid-choice error.
Sourcepub exec fn invalid_length() -> Self
pub exec fn invalid_length() -> Self
Creates an invalid-length error.
Sourcepub exec fn length_mismatch() -> Self
pub exec fn length_mismatch() -> Self
Creates a length-mismatch error.
Sourcepub exec fn predicate_failed() -> Self
pub exec fn predicate_failed() -> Self
Creates a predicate-failed error.
Sourcepub exec fn cond_rejected() -> Self
pub exec fn cond_rejected() -> Self
Creates a condition-rejected error.
Sourcepub exec fn non_canonical() -> Self
pub exec fn non_canonical() -> Self
Creates a non-canonical-encoding error.
Sourcepub exec fn overflow() -> e : Self
pub exec fn overflow() -> e : Self
e.kind == ParseErrorKind::Overflow,Creates an overflow error.
Sourcepub exec fn recursion_limit_exceeded() -> Self
pub exec fn recursion_limit_exceeded() -> Self
Creates a recursion-limit-exceeded error.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
Available on crate feature std only.
impl Error for ParseError
std only.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 PartialEq for ParseError
impl PartialEq for ParseError
Source§fn eq(&self, other: &ParseError) -> bool
fn eq(&self, other: &ParseError) -> bool
self and other values to be equal, and is used by ==.