From c6c686d514a0517a5df9a41abbea94a0d44d8b0f Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 5 Jan 2020 19:09:27 -0500 Subject: [PATCH] Implement Display for Whitespace --- src/common.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/common.rs b/src/common.rs index 6ba4399..cda2436 100644 --- a/src/common.rs +++ b/src/common.rs @@ -209,6 +209,17 @@ pub enum Whitespace { CarriageReturn, } +impl Display for Whitespace { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Whitespace::Space => write!(f, " "), + Whitespace::Tab => write!(f, "\t"), + Whitespace::Newline => write!(f, "\n"), + Whitespace::CarriageReturn => write!(f, "\r"), + } + } +} + impl TryFrom for Whitespace { type Error = &'static str;