Struct os_error::OsError [] [src]

pub struct OsError { /* fields omitted */ }

Methods

impl OsError
[src]

[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);

[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());

[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());
}

[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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for OsError
[src]

impl PartialEq for OsError
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl PartialOrd for OsError
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[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]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl Hash for OsError
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for OsError
[src]

[src]

Formats the value using the given formatter.

impl Display for OsError
[src]

[src]

Formats the value using the given formatter. Read more

impl Into<Error> for OsError
[src]

[src]

Performs the conversion.