# Trait failure::ResultExt [−] [src]

    pub trait ResultExt<T, E> {
        fn compat(self) -> Result<T, Compat<E>>;
        fn context<D>(self, context: D) -> Result<T, Context<D>>
        where
            D: Display + Send + Sync + 'static;
        fn with_context<F, D>(self, f: F) -> Result<T, Context<D>>
        where
            F: FnOnce(&E) -> D,
            D: Display + Send + Sync + 'static;
    }

Extension methods for `Result`.

## Required Methods

### `fn compat(self) -> Result<T, Compat<E>>`

Wraps the error in `Compat` to make it compatible with older error handling APIs that expect `std::error::Error`.

### `fn context<D>(self, context: D) -> Result<T, Context<D>> where
D: Display + Send + Sync + 'static,`

Wraps the error type in a context type.

### `fn with_context<F, D>(self, f: F) -> Result<T, Context<D>> where
F: FnOnce(&E) -> D,
D: Display + Send + Sync + 'static,`

Wraps the error type in a context type generated by looking at the error value.

## Implementations on Foreign Types

### `impl<T, E> ResultExt<T, E> for Result<T, E> where
E: Fail,`
[src]

#### `fn compat(self) -> Result<T, Compat<E>>`
[src]

#### `fn context<D>(self, context: D) -> Result<T, Context<D>> where
D: Display + Send + Sync + 'static,`
[src]

#### `fn with_context<F, D>(self, f: F) -> Result<T, Context<D>> where
F: FnOnce(&E) -> D,
D: Display + Send + Sync + 'static,`
[src]

### `impl<T> ResultExt<T, Error> for Result<T, Error>`
[src]

#### `fn compat(self) -> Result<T, Compat<Error>>`
[src]

#### `fn context<D>(self, context: D) -> Result<T, Context<D>> where
D: Display + Send + Sync + 'static,`
[src]

#### `fn with_context<F, D>(self, f: F) -> Result<T, Context<D>> where
F: FnOnce(&Error) -> D,
D: Display + Send + Sync + 'static,`
[src]

## Implementors

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## 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`)