From d36157a57cb3c4febc86cfe893dd1e7de83c7d17 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 14 Apr 2022 11:37:07 +0200 Subject: [PATCH] identifiers: Add Display implementation for owned types --- crates/ruma-macros/src/identifiers.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ruma-macros/src/identifiers.rs b/crates/ruma-macros/src/identifiers.rs index c87f9f74..69d6a18a 100644 --- a/crates/ruma-macros/src/identifiers.rs +++ b/crates/ruma-macros/src/identifiers.rs @@ -265,6 +265,12 @@ fn expand_owned_id(id: &Ident, owned: &Ident) -> TokenStream { } } + impl std::fmt::Display for #owned { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.as_str()) + } + } + impl serde::Serialize for #owned { fn serialize(&self, serializer: S) -> Result where