about summary refs log tree commit diff
path: root/src/libstd/fmt/mod.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-01 11:11:28 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 08:16:14 -0700
commita156534a96a6c401b14c80618c247eaadf876eb7 (patch)
tree3970353a35afc4604ffe188ac633be50a22946f2 /src/libstd/fmt/mod.rs
parentf12b51705b064bbbeb86ad65663de476d07ad51f (diff)
downloadrust-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.rs9
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 {