Skip to content

Commit 70f4269

Browse files
committed
Doc for From ErrorKind
1 parent 96282e1 commit 70f4269

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: src/libstd/io/error.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,19 @@ impl ErrorKind {
214214
impl From<ErrorKind> for Error {
215215
/// Converts a [`ErrorKind`] into a [`Error`].
216216
///
217-
/// This conversion allocates a new error with simple repr.
217+
/// This conversion allocates a new error with a simple representation of error kind.
218218
///
219-
/// [`ErrorKind`]: enum.ErrorKind.html
220-
/// [`Error`]: struct.Error.html
219+
/// # Examples
220+
///
221+
/// ```
222+
/// use std::io::{Error, ErrorKind};
223+
///
224+
/// fn main() {
225+
/// let not_found = ErrorKind::NotFound;
226+
/// let error = Error::from(not_found);
227+
/// assert_eq!("entity not found", format!("{}", error));
228+
/// }
229+
/// ```
221230
#[inline]
222231
fn from(kind: ErrorKind) -> Error {
223232
Error {

0 commit comments

Comments
 (0)