Skip to content

Commit ae235ae

Browse files
authored
Rollup merge of rust-lang#34190 - ollie27:wrapping_fmt, r=alexcrichton
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T> Fixes: rust-lang#33659
2 parents 66b82be + ee46905 commit ae235ae

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/libcore/num/mod.rs

Lines changed: 28 additions & 0 deletions
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)