diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-30 21:35:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:14:56 -0700 |
| commit | 06fcb6b1c81f1f5190d431c169cd0c725fecf18e (patch) | |
| tree | d746b63d32bea327145b5b224c9efa093097da4b /src/libstd/fmt | |
| parent | 6636215a44b27d1806a2ac646bde1d4ecaa801c4 (diff) | |
| download | rust-06fcb6b1c81f1f5190d431c169cd0c725fecf18e.tar.gz rust-06fcb6b1c81f1f5190d431c169cd0c725fecf18e.zip | |
core: Inherit the option module
Diffstat (limited to 'src/libstd/fmt')
| -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 21121449205..a20f0392771 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -1280,6 +1280,15 @@ impl<'a> Show for &'a any::Any { fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") } } +impl<T: Show> Show for Option<T> { + fn fmt(&self, f: &mut Formatter) -> Result { + match *self { + Some(ref t) => write!(f.buf, "Some({})", *t), + None => write!(f.buf, "None"), + } + } +} + impl Show for () { fn fmt(&self, f: &mut Formatter) -> Result { f.pad("()") |
