commit | cb1b85f2ab4d340b536e0a2a863c236ebb889f25 | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Sat Jun 03 16:40:35 2017 -0700 |
committer | David Tolnay <dtolnay@gmail.com> | Sat Jun 03 16:42:02 2017 -0700 |
tree | cdfaebc12e356721d1cbf78479688608242f056c | |
parent | 64bb1b3f1da17a736354058ff27e050f5ccc7a7f [diff] [blame] |
Forward Debug and Display for newtype wrappers
diff --git a/src/macros.rs b/src/macros.rs new file mode 100644 index 0000000..89eb554 --- /dev/null +++ b/src/macros.rs
@@ -0,0 +1,9 @@ +macro_rules! forward_fmt { + ($tr:ident for $ty:ident) => { + impl ::std::fmt::$tr for $ty { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::std::fmt::$tr::fmt(&self.0, f) + } + } + } +}