]> git.lizzy.rs Git - rust.git/commitdiff
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>
authorOliver Middleton <olliemail27@gmail.com>
Thu, 9 Jun 2016 22:03:14 +0000 (23:03 +0100)
committerOliver Middleton <olliemail27@gmail.com>
Thu, 9 Jun 2016 22:03:14 +0000 (23:03 +0100)
src/libcore/num/mod.rs

index 883e9206dde1d3ad9e2a8fd3e4bc1b0c373ba939..06398fc094e8584fcf1704ff645c3cc456414e31 100644 (file)
@@ -66,6 +66,34 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
+#[stable(feature = "wrapping_fmt", since = "1.11.0")]
+impl<T: fmt::Binary> fmt::Binary for Wrapping<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.0.fmt(f)
+    }
+}
+
+#[stable(feature = "wrapping_fmt", since = "1.11.0")]
+impl<T: fmt::Octal> fmt::Octal for Wrapping<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.0.fmt(f)
+    }
+}
+
+#[stable(feature = "wrapping_fmt", since = "1.11.0")]
+impl<T: fmt::LowerHex> fmt::LowerHex for Wrapping<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.0.fmt(f)
+    }
+}
+
+#[stable(feature = "wrapping_fmt", since = "1.11.0")]
+impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.0.fmt(f)
+    }
+}
+
 mod wrapping;
 
 // All these modules are technically private and only exposed for libcoretest: