# [−][src]Trait actix_web::AsyncResponder

    pub trait AsyncResponder<I, E>: Sized {
        fn responder(self) -> Box<Future<Item = I, Error = E>>;
    }

Convenience trait that converts `Future` object to a `Boxed` future

For example loading json from request's body is async operation.

    use actix_web::{
        App, AsyncResponder, Error, HttpMessage, HttpRequest, HttpResponse,
    };
    use futures::future::Future;

    #[derive(Deserialize, Debug)]
    struct MyObj {
        name: String,
    }

    fn index(mut req: HttpRequest) -> Box<Future<Item = HttpResponse, Error = Error>> {
        req.json()                   // <- get JsonBody future
           .from_err()
           .and_then(|val: MyObj| {  // <- deserialized value
               Ok(HttpResponse::Ok().into())
           })
        // Construct boxed future by using `AsyncResponder::responder()` method
        .responder()
    }

## Required Methods

### `fn responder(self) -> Box<Future<Item = I, Error = E>>`

Convert to a boxed future

## Implementors

###

`impl<F, I, E> AsyncResponder<I, E> for F where F: Future<Item = I, Error = E> + 'static, I: Responder + 'static, E: Into<Error> + 'static,`

[src]

####

`fn responder(self) -> Box<Future<Item = I, Error = E>>`

[src]

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

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)