diff options
| -rw-r--r-- | src/libstd/io/error.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index a6b46fa20b1..cf5b9c75e9f 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -214,10 +214,19 @@ impl ErrorKind { impl From<ErrorKind> for Error { /// Converts a [`ErrorKind`] into a [`Error`]. /// - /// This conversion allocates a new error with simple repr. + /// This conversion allocates a new error with a simple representation of error kind. /// - /// [`ErrorKind`]: enum.ErrorKind.html - /// [`Error`]: struct.Error.html + /// # Examples + /// + /// ``` + /// use std::io::{Error, ErrorKind}; + /// + /// fn main() { + /// let not_found = ErrorKind::NotFound; + /// let error = Error::from(not_found); + /// assert_eq!("entity not found", format!("{}", error)); + /// } + /// ``` #[inline] fn from(kind: ErrorKind) -> Error { Error { |
