Struct os_error::OsError
[−]
[src]
pub struct OsError { /* fields omitted */ }
Methods
impl OsError
[src]
fn new(code: i32) -> OsError
[src]
Creates a new instance of an OsError
from a particular OS error code.
Examples
On Linux:
use std::io; let error = os_error::OsError::new(98); assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
On Windows:
use std::io; let error = os_error::OsError::new(10048); assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
fn last_os_error() -> OsError
[src]
Returns an error representing the last OS error which occurred.
This function reads the value of errno
for the target platform (e.g.
GetLastError
on Windows) and will return a corresponding instance of
OsError
for the error code.
Examples
use os_error::OsError; println!("last OS error: {:?}", OsError::last_os_error());
fn code(&self) -> i32
[src]
Returns the OS error that this error represents.
Examples
use os_error::OsError; fn main() { // Will print "raw OS error: ...". println!("raw OS error: {:?}", OsError::last_os_error().code()); }
fn kind(&self) -> ErrorKind
[src]
Returns the corresponding ErrorKind
for this error.
Examples
use os_error::OsError; fn main() { // Will print "No inner error". println!("{:?}", OsError::last_os_error()); }
Trait Implementations
impl Clone for OsError
[src]
fn clone(&self) -> OsError
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for OsError
[src]
impl PartialEq for OsError
[src]
fn eq(&self, __arg_0: &OsError) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &OsError) -> bool
[src]
This method tests for !=
.
impl PartialOrd for OsError
[src]
fn partial_cmp(&self, __arg_0: &OsError) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &OsError) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &OsError) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &OsError) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &OsError) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Eq for OsError
[src]
impl Ord for OsError
[src]
fn cmp(&self, __arg_0: &OsError) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for OsError
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for OsError
[src]
impl Display for OsError
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more