We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b2d6ea9 + 4f3896d commit b9adc33Copy full SHA for b9adc33
src/libstd/io/error.rs
@@ -212,6 +212,19 @@ impl ErrorKind {
212
/// the heap (for normal construction via Error::new) is too costly.
213
#[stable(feature = "io_error_from_errorkind", since = "1.14.0")]
214
impl From<ErrorKind> for Error {
215
+ /// Converts an [`ErrorKind`] into an [`Error`].
216
+ ///
217
+ /// This conversion allocates a new error with a simple representation of error kind.
218
219
+ /// # Examples
220
221
+ /// ```
222
+ /// use std::io::{Error, ErrorKind};
223
224
+ /// let not_found = ErrorKind::NotFound;
225
+ /// let error = Error::from(not_found);
226
+ /// assert_eq!("entity not found", format!("{}", error));
227
228
#[inline]
229
fn from(kind: ErrorKind) -> Error {
230
Error {
0 commit comments