From cc723f7684429b89d356ddf2db64f68eb319bb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 13 Nov 2021 21:45:30 +0100 Subject: [PATCH] pkstrings: impl fmt::Display for Error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- pkstrings/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkstrings/src/lib.rs b/pkstrings/src/lib.rs index 58557cd..06b023c 100644 --- a/pkstrings/src/lib.rs +++ b/pkstrings/src/lib.rs @@ -91,6 +91,14 @@ pub enum Error { InvalidCharacter, } +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match self { + Error::InvalidCharacter => write!(f, "Invalid character"), + } + } +} + #[derive(Debug, Clone, Eq, PartialEq)] pub struct PKString(String);