diff options
Diffstat (limited to 'src/libstd/io/mod.rs')
| -rw-r--r-- | src/libstd/io/mod.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 465c4f9c5c7..010cb814732 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -302,7 +302,7 @@ pub type IoResult<T> = Result<T, IoError>; /// # FIXME /// /// Is something like this sufficient? It's kind of archaic -#[derive(PartialEq, Eq, Clone)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct IoError { /// An enumeration which can be matched against for determining the flavor /// of error. @@ -339,7 +339,7 @@ impl IoError { } } -impl fmt::Show for IoError { +impl fmt::String for IoError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match *self { IoError { kind: OtherIoError, desc: "unknown error", detail: Some(ref detail) } => @@ -1656,7 +1656,7 @@ pub fn standard_error(kind: IoErrorKind) -> IoError { /// A mode specifies how a file should be opened or created. These modes are /// passed to `File::open_mode` and are used to control where the file is /// positioned when it is initially opened. -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Show)] pub enum FileMode { /// Opens a file positioned at the beginning. Open, @@ -1668,7 +1668,7 @@ pub enum FileMode { /// Access permissions with which the file should be opened. `File`s /// opened with `Read` will return an error if written to. -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Show)] pub enum FileAccess { /// Read-only access, requests to write will result in an error Read, @@ -1826,6 +1826,12 @@ impl Default for FilePermission { impl fmt::Show for FilePermission { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl fmt::String for FilePermission { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:04o}", self.bits) } } |
