File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,30 @@ impl Error {
214214 }
215215
216216 /// Creates a new instance of an `Error` from a particular OS error code.
217+ ///
218+ /// # Examples
219+ ///
220+ /// On Unix:
221+ ///
222+ /// ```
223+ /// # if cfg!(unix) {
224+ /// use std::io;
225+ ///
226+ /// let error = io::Error::from_raw_os_error(98);
227+ /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
228+ /// # }
229+ /// ```
230+ ///
231+ /// On Windows:
232+ ///
233+ /// ```
234+ /// # if cfg!(windows) {
235+ /// use std::io;
236+ ///
237+ /// let error = io::Error::from_raw_os_error(10048);
238+ /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
239+ /// # }
240+ /// ```
217241 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
218242 pub fn from_raw_os_error ( code : i32 ) -> Error {
219243 Error { repr : Repr :: Os ( code) }
You can’t perform that action at this time.
0 commit comments