Skip to content

Commit ee46905

Browse files
committed
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>
1 parent 0740a93 commit ee46905

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/libcore/num/mod.rs

+28
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,34 @@ impl<T: fmt::Display> fmt::Display for Wrapping<T> {
6666
}
6767
}
6868

69+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
70+
impl<T: fmt::Binary> fmt::Binary for Wrapping<T> {
71+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
72+
self.0.fmt(f)
73+
}
74+
}
75+
76+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
77+
impl<T: fmt::Octal> fmt::Octal for Wrapping<T> {
78+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
79+
self.0.fmt(f)
80+
}
81+
}
82+
83+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
84+
impl<T: fmt::LowerHex> fmt::LowerHex for Wrapping<T> {
85+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
86+
self.0.fmt(f)
87+
}
88+
}
89+
90+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
91+
impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
92+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
93+
self.0.fmt(f)
94+
}
95+
}
96+
6997
mod wrapping;
7098

7199
// All these modules are technically private and only exposed for libcoretest:

0 commit comments

Comments
 (0)