pub trait IntoResponse {
    type Err: Into<HandlerError> + Send + Sync + 'static;

    // Required method
    fn into_response(self) -> BoxFuture<'static, Result<Response, Self::Err>>;

    // Provided method
    fn accepted_types() -> Option<Vec<Mime>> { ... }
}
Expand description

This trait needs to be implemented by every type returned from an endpoint to to provide the response.

Required Associated Types§

source

type Err: Into<HandlerError> + Send + Sync + 'static

Required Methods§

source

fn into_response(self) -> BoxFuture<'static, Result<Response, Self::Err>>

Turn this into a response that can be returned to the browser. This api will likely change in the future.

Provided Methods§

source

fn accepted_types() -> Option<Vec<Mime>>

Return a list of supported mime types.

Implementations on Foreign Types§

source§

impl<R, E> IntoResponse for Result<R, E>where R: ResponseBody, E: Debug + IntoResponseError<Err = Error>,

source§

impl<E> IntoResponse for Result<NoContent, E>where E: Debug + IntoResponseError<Err = Error>,

source§

impl<E> IntoResponse for Result<Redirect, E>where E: Debug + IntoResponseError, <E as IntoResponseError>::Err: StdError + Sync,

§

type Err = RedirectError<<E as IntoResponseError>::Err>

source§

fn into_response(self) -> BoxFuture<'static, Result<Response, Self::Err>>

source§

impl<T, E> IntoResponse for Result<Raw<T>, E>where Raw<T>: IntoResponse, E: Debug + IntoResponseError<Err = <Raw<T> as IntoResponse>::Err>,

§

type Err = <E as IntoResponseError>::Err

source§

fn into_response( self ) -> Pin<Box<dyn Future<Output = Result<Response, E::Err>> + Send>>

source§

impl<Res> IntoResponse for Pin<Box<dyn Future<Output = Res> + Send>>where Res: IntoResponse + 'static,

§

type Err = <Res as IntoResponse>::Err

source§

fn into_response( self ) -> Pin<Box<dyn Future<Output = Result<Response, Self::Err>> + Send>>

source§

fn accepted_types() -> Option<Vec<Mime>>

Implementors§