pub enum ParseError {
Incomplete,
InvalidChar(usize),
ExpectedLiteral {
expected: String,
offset: usize,
},
UnexpectedEof,
InvalidNumber,
LiteralTooLarge {
got: usize,
max: usize,
},
Malformed(&'static str),
Other(&'static str),
}Expand description
Errors produced by the IMAP response parser.
Variants§
Incomplete
Input ended before a complete response could be parsed. The caller should accumulate more bytes and retry.
InvalidChar(usize)
A byte that is invalid at the current grammar position was found. The value is the byte offset into the input where it occurred.
ExpectedLiteral
An expected literal token was not present at the given offset.
Fields
UnexpectedEof
Input ended unexpectedly in the middle of a token.
InvalidNumber
A numeric field could not be parsed as a valid integer.
LiteralTooLarge
A literal whose declared length exceeds the parser’s hard cap. Used as an explicit DoS guard against hostile servers.
Fields
Malformed(&'static str)
Well-formed bytes that nonetheless violate the response grammar. The value is a human-readable description of the violation.
Other(&'static str)
A parsing error that does not fit any of the more specific variants.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
impl Eq for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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 ==.