We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 96282e1 commit 70f4269Copy full SHA for 70f4269
src/libstd/io/error.rs
@@ -214,10 +214,19 @@ impl ErrorKind {
214
impl From<ErrorKind> for Error {
215
/// Converts a [`ErrorKind`] into a [`Error`].
216
///
217
- /// This conversion allocates a new error with simple repr.
+ /// This conversion allocates a new error with a simple representation of error kind.
218
219
- /// [`ErrorKind`]: enum.ErrorKind.html
220
- /// [`Error`]: struct.Error.html
+ /// # Examples
+ ///
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
230
#[inline]
231
fn from(kind: ErrorKind) -> Error {
232
Error {
0 commit comments