From 8e4ef1ab2a20d65047b1dd3f8ce671f42dc52fa7 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 27 Jul 2022 14:30:50 +0200 Subject: [PATCH] Implement std::error::Error for ParseWeekdayError --- src/weekday.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/weekday.rs b/src/weekday.rs index 58f61f2fcb..a252cf352d 100644 --- a/src/weekday.rs +++ b/src/weekday.rs @@ -191,9 +191,18 @@ pub struct ParseWeekdayError { pub(crate) _dummy: (), } +#[cfg(feature = "std")] +impl std::error::Error for ParseWeekdayError {} + +impl fmt::Display for ParseWeekdayError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{:?}", self)) + } +} + impl fmt::Debug for ParseWeekdayError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "ParseWeekdayError {{ .. }}") + f.debug_struct("ParseWeekdayError").finish_non_exhaustive() } }