We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d78974 commit 289eb78Copy full SHA for 289eb78
library/std/src/io/error.rs
@@ -392,6 +392,9 @@ impl Error {
392
/// originate from the OS itself. The `error` argument is an arbitrary
393
/// payload which will be contained in this [`Error`].
394
///
395
+ /// If no extra payload is required, use the `From` conversion from
396
+ /// `ErrorKind`.
397
+ ///
398
/// # Examples
399
400
/// ```
@@ -402,6 +405,9 @@ impl Error {
402
405
403
406
/// // errors can also be created from other errors
404
407
/// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
408
409
+ /// // creating an error without payload
410
+ /// let eof_error = Error::from(ErrorKind::UnexpectedEof);
411
412
#[stable(feature = "rust1", since = "1.0.0")]
413
pub fn new<E>(kind: ErrorKind, error: E) -> Error
0 commit comments