pub trait ApiResponse<T> {
    // Required method
    fn into_json_response(self) -> ApiJsonResponse<T>;
}
Expand description

This trait allows to consume an object into an HTTP response.

Required Methods§

source

fn into_json_response(self) -> ApiJsonResponse<T>

Consumes the value and creates a JSON or a Status result response.

Implementations on Foreign Types§

source§

impl<T> ApiResponse<T> for Json<T>

Prepares an API response from a JSON.

Implementors§

source§

impl<T> ApiResponse<T> for Twhere T: Serialize,

Prepares an API response from a Serde-serializable result.

This is probably the easiest way to convert most struct into API responders.

Examples