[][src]Trait tower_web::response::Response

pub trait Response {
    type Buf: Buf;
    type Body: BufStream<Item = Self::Buf, Error = Error>;
    fn into_http<S: Serializer>(
        self,
        context: &Context<S>
    ) -> Result<Response<Self::Body>, Error>; }

Types that can be returned from resources as responses to HTTP requests.

Implementations of Response are responsible for encoding the value using the appropriate content type. The content type may be specific to the type in question, for example serde_json::Value implies a content type of application/json.

Alternatively, the provided context may be used to encode the response in most suitable content-type based on the request context. The content-type is picked using the following factors:

Implementations of Response are able to asynchronously stream the response body if needed. This is done by setting the HTTP response body to a BufStream type that supports streaming.

Associated Types

Data chunk type.

The HTTP response body type.

Required Methods

Convert the value into a response future

Implementations on Foreign Types

impl<A, B> Response for Either<A, B> where
    A: Response,
    B: Response
[src]

impl Response for File
[src]

impl Response for Value
[src]

impl<T: Response> Response for Option<T>
[src]

impl<T> Response for Response<T> where
    T: BufStream
[src]

impl Response for String
[src]

impl Response for &'static str
[src]

impl<T> Response for Vec<T> where
    T: Serialize
[src]

Implementors

impl<T> Response for SerdeResponse<T> where
    T: Serialize
[src]