#[non_exhaustive]pub enum ParseReleaseDateError {
WrongLength {
found: usize,
},
NotASeparator {
index: usize,
found: u8,
},
NotADigit {
index: usize,
found: u8,
},
MonthOutOfRange {
month: u16,
},
DayOutOfRange {
year: u16,
month: u8,
day: u16,
last: u8,
},
BeforeFirstRevision {
date: ReleaseDate,
},
}Expand description
Why a string is not a YYYY-MM-DD release date.
Every variant names a byte offset rather than a character offset: the parser
reads bytes and never slices the &str, so a multi-byte character at an
unexpected position is reported by its lead byte. The distinction matters
only for the message, and the alternative — a char from chars().nth —
would report a different character from the one that actually failed.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WrongLength
The string was not exactly ten bytes long.
NotASeparator
A separator was expected and something else was there.
NotADigit
A digit was expected and something else was there.
MonthOutOfRange
The month was outside 1..=12.
DayOutOfRange
The day was outside 1..= the length of that month.
Fields
BeforeFirstRevision
The date is well formed but predates the protocol.
A separate variant from the shape errors above because the fix is
different: a WrongLength means the peer sent something that is not a
version, and this means the peer sent a version from before MCP existed.
Fields
date: ReleaseDateThe date that was supplied.
Trait Implementations§
Source§impl Clone for ParseReleaseDateError
impl Clone for ParseReleaseDateError
impl Copy for ParseReleaseDateError
Source§impl Debug for ParseReleaseDateError
impl Debug for ParseReleaseDateError
Source§impl Display for ParseReleaseDateError
impl Display for ParseReleaseDateError
impl Eq for ParseReleaseDateError
Source§impl Error for ParseReleaseDateError
impl Error for ParseReleaseDateError
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()