File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -392,6 +392,9 @@ impl Error {
392
392
/// originate from the OS itself. The `error` argument is an arbitrary
393
393
/// payload which will be contained in this [`Error`].
394
394
///
395
+ /// If no extra payload is required, use the `From` conversion from
396
+ /// `ErrorKind`.
397
+ ///
395
398
/// # Examples
396
399
///
397
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);
405
411
/// ```
406
412
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
407
413
pub fn new < E > ( kind : ErrorKind , error : E ) -> Error
You can’t perform that action at this time.
0 commit comments