Skip to content

Commit

Permalink
Doc for From ErrorKind
Browse files Browse the repository at this point in the history
  • Loading branch information
phungleson committed Sep 26, 2018
1 parent 96282e1 commit 70f4269
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/libstd/io/error.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 70f4269

Please sign in to comment.