File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -214,10 +214,19 @@ impl ErrorKind {
214
214
impl From < ErrorKind > for Error {
215
215
/// Converts a [`ErrorKind`] into a [`Error`].
216
216
///
217
- /// This conversion allocates a new error with simple repr .
217
+ /// This conversion allocates a new error with a simple representation of error kind .
218
218
///
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
+ /// ```
221
230
#[ inline]
222
231
fn from ( kind : ErrorKind ) -> Error {
223
232
Error {
You can’t perform that action at this time.
0 commit comments