Skip to content

Commit

Permalink
Implement Display trait for URL types
Browse files Browse the repository at this point in the history
  • Loading branch information
ramosbugs committed Feb 21, 2024
1 parent d9402c4 commit 8bd0ff1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 8bd0ff1

Please sign in to comment.