From 7b536e5bfc4be06773c761c5efc1257cc36cb0c5 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 18 Oct 2019 13:05:33 +0200 Subject: [PATCH] macros: Implement Display for attributes. --- src/util/macros.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/macros.rs b/src/util/macros.rs index d63591a..d703e25 100644 --- a/src/util/macros.rs +++ b/src/util/macros.rs @@ -85,6 +85,13 @@ macro_rules! generate_attribute { }) } } + impl std::fmt::Display for $elem { + fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + write!(fmt, "{}", match self { + $($elem::$a => $b),+ + }) + } + } impl ::minidom::IntoAttributeValue for $elem { fn into_attribute_value(self) -> Option { Some(String::from(match self {