From 70f4269d978090d8ce9a334d9694c8a1f1480eba Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 27 Sep 2018 05:34:12 +1000 Subject: Doc for From ErrorKind --- src/libstd/io/error.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/libstd') 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 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 { -- cgit 1.4.1-3-g733a5