pub trait HttpResponse {
    // Required methods
    fn to_result(self) -> Result<Response<Body>, HttpError>;
    fn response_metadata() -> ApiEndpointResponse;
}
Expand description

HttpResponse must produce a Result<Response<Body>, HttpError> and generate the response metadata. Typically one should use Response<Body> or an implementation of HttpTypedResponse.

Required Methods§

source

fn to_result(self) -> Result<Response<Body>, HttpError>

Generate the response to the HTTP call.

source

fn response_metadata() -> ApiEndpointResponse

Extract status code and structure metadata for the non-error response. Type information for errors is handled generically across all endpoints.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl HttpResponse for Response<Body>

Response<Body> is used for free-form responses. The implementation of to_result() is trivial, and we don’t have any typed metadata to return.

Implementors§

source§

impl<T> HttpResponse for T

Provide results and metadata generation for all implementing types.

source§

impl<T: HttpCodedResponse, H: JsonSchema + Serialize + Send + Sync + 'static> HttpResponse for HttpResponseHeaders<T, H>