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 {
392392 /// originate from the OS itself. The `error` argument is an arbitrary
393393 /// payload which will be contained in this [`Error`].
394394 ///
395+ /// If no extra payload is required, use the `From` conversion from
396+ /// `ErrorKind`.
397+ ///
395398 /// # Examples
396399 ///
397400 /// ```
@@ -402,6 +405,9 @@ impl Error {
402405 ///
403406 /// // errors can also be created from other errors
404407 /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
408+ ///
409+ /// // creating an error without payload
410+ /// let eof_error = Error::from(ErrorKind::UnexpectedEof);
405411 /// ```
406412 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
407413 pub fn new < E > ( kind : ErrorKind , error : E ) -> Error
You can’t perform that action at this time.
0 commit comments