diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-01 11:11:28 -0700 | 
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:16:14 -0700 | 
| commit | a156534a96a6c401b14c80618c247eaadf876eb7 (patch) | |
| tree | 3970353a35afc4604ffe188ac633be50a22946f2 /src/libstd/fmt/mod.rs | |
| parent | f12b51705b064bbbeb86ad65663de476d07ad51f (diff) | |
| download | rust-a156534a96a6c401b14c80618c247eaadf876eb7.tar.gz rust-a156534a96a6c401b14c80618c247eaadf876eb7.zip | |
core: Inherit the result module
The unwrap()/unwrap_err() methods are temporarily removed, and will be added back in the next commit.
Diffstat (limited to 'src/libstd/fmt/mod.rs')
| -rw-r--r-- | src/libstd/fmt/mod.rs | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index 9f683e45678..8cfc0ae54c3 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -1291,6 +1291,15 @@ impl<T: Show> Show for Option<T> { } } +impl<T: Show, U: Show> Show for ::result::Result<T, U> { + fn fmt(&self, f: &mut Formatter) -> Result { + match *self { + Ok(ref t) => write!(f.buf, "Ok({})", *t), + Err(ref t) => write!(f.buf, "Err({})", *t), + } + } +} + impl<'a, T: Show> Show for &'a [T] { fn fmt(&self, f: &mut Formatter) -> Result { if f.flags & (1 << (parse::FlagAlternate as uint)) == 0 { | 
