about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorSon <leson.phung@gmail.com>2018-09-27 05:34:12 +1000
committerSon <leson.phung@gmail.com>2018-09-27 05:34:12 +1000
commit70f4269d978090d8ce9a334d9694c8a1f1480eba (patch)
tree59dcf608219699d6e02ed1df6f5016c5342f6fb6 /src/libstd/io
parent96282e186618691977192a6cace47f86d8a9aec5 (diff)
downloadrust-70f4269d978090d8ce9a334d9694c8a1f1480eba.tar.gz
rust-70f4269d978090d8ce9a334d9694c8a1f1480eba.zip
Doc for From ErrorKind
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/error.rs15
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 {