chiark / gitweb /
Provide DebugExt::to_debug
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 May 2021 22:56:34 +0000 (23:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 May 2021 23:00:27 +0000 (00:00 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
base/misc.rs

index c6bbe0615695b7da051aba6ff427a23d176526e7..faa47bc4018bedb8a34ad7a47f15700ec3e90639 100644 (file)
@@ -84,3 +84,8 @@ macro_rules! if_let {
     };
   };
 }
+
+#[ext(pub, name=DebugExt)]
+impl<T:Debug> T {
+  fn to_debug(&self) -> String { format!("{:?}", self) }
+}