# Struct bitflags::__core::io::Error [−] [src]

    pub struct Error {
        // some fields omitted
    }

1.0.0

The error type for I/O operations of the `Read`, `Write`, `Seek`, and associated traits.

Errors mostly originate from the underlying OS, but custom instances of `Error` can be created with crafted error messages and a particular value of `ErrorKind`.

## Methods

### `impl Error`

#### `fn new<E>(kind: ErrorKind, error: E) -> Error where E: Into<Box<Error + 'static + Send + Sync>>`

Creates a new I/O error from a known kind of error as well as an arbitrary error payload.

This function is used to generically create I/O errors which do not originate from the OS itself. The `error` argument is an arbitrary payload which will be contained in this `Error`.

# Examples

    use std::io::{Error, ErrorKind};

    // errors can be created from strings
    let custom_error = Error::new(ErrorKind::Other, "oh no!");

    // errors can also be created from other errors
    let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);

#### `fn last_os_error() -> Error`

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 `Error` for the error code.

#### `fn from_raw_os_error(code: i32) -> Error`

Creates a new instance of an `Error` from a particular OS error code.

#### `fn raw_os_error(&self) -> Option<i32>`

Returns the OS error that this error represents (if any).

If this `Error` was constructed via `last_os_error` or `from_raw_os_error`, then this function will return `Some`, otherwise it will return `None`.

#### `fn get_ref(&self) -> Option<&Error + 'static + Send + Sync>`1.3.0

Returns a reference to the inner error wrapped by this error (if any).

If this `Error` was constructed via `new` then this function will return `Some`, otherwise it will return `None`.

#### `fn get_mut(&mut self) -> Option<&mut Error + 'static + Send + Sync>`1.3.0

Returns a mutable reference to the inner error wrapped by this error (if any).

If this `Error` was constructed via `new` then this function will return `Some`, otherwise it will return `None`.

#### `fn into_inner(self) -> Option<Box<Error + 'static + Send + Sync>>`1.3.0

Consumes the `Error`, returning its inner error (if any).

If this `Error` was constructed via `new` then this function will return `Some`, otherwise it will return `None`.

#### `fn kind(&self) -> ErrorKind`

Returns the corresponding `ErrorKind` for this error.

## Trait Implementations

### `impl From<NulError> for Error`

#### `fn from(NulError) -> Error`

### `impl<W> From<IntoInnerError<W>> for Error`

#### `fn from(iie: IntoInnerError<W>) -> Error`

### `impl Display for Error`

#### `fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>`

### `impl Error for Error`

#### `fn description(&self) -> &str`

#### `fn cause(&self) -> Option<&Error>`

### Derived Implementations

### `impl Debug for Error`

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)