#[non_exhaustive]pub enum ParseError {
EmptyInput,
NoHeaders,
InvalidRange {
offset: u32,
length: u32,
available: u64,
},
}Expand description
Error returned when parse() cannot produce any result from the input bytes.
Best-effort parsing: malformed-but-parseable input yields a ParsedMessage
with warnings populated. Only truly unrecoverable input returns Err.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EmptyInput
The input byte slice is empty.
NoHeaders
The input contains no recognizable RFC 5322 headers.
InvalidRange
The byte range specified in a ParsedPart extends beyond the raw message bytes.
offset and length are u32 to match ParsedPart::body_range.
available is u64 because it comes from raw.len() as u64 —
using u64 avoids a lossy truncation on platforms where usize > u32
and makes the error message unambiguous even if the slice length
exceeds 4 GiB (which ParsedPart cannot address, but the caller’s
buffer might be that large).
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl<'de> Deserialize<'de> for ParseError
impl<'de> Deserialize<'de> for ParseError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 ==.