From 8bd0ff1e0339c0945871552210b300c05e89c519 Mon Sep 17 00:00:00 2001 From: "David A. Ramos" Date: Tue, 20 Feb 2024 18:59:16 -0800 Subject: [PATCH] Implement Display trait for URL types --- src/types.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/types.rs b/src/types.rs index 146be7f..b3cb47a 100644 --- a/src/types.rs +++ b/src/types.rs @@ -272,6 +272,11 @@ macro_rules! new_url_type { &self.1 } } + impl ::std::fmt::Display for $name { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> { + write!(f, "{}", self.1) + } + } impl ::std::fmt::Debug for $name { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> { let mut debug_trait_builder = f.debug_tuple(stringify!($name));