Skip to content

Commit

Permalink
Rollup merge of rust-lang#34190 - ollie27:wrapping_fmt, r=alexcrichton
Browse files Browse the repository at this point in the history
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>

Fixes: rust-lang#33659
  • Loading branch information
Manishearth authored Jun 22, 2016
2 parents 66b82be + ee46905 commit e4ff7f0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ impl<T: fmt::Display> fmt::Display for Wrapping<T> {
}
}

#[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:
Expand Down

0 comments on commit e4ff7f0

Please sign in to comment.