Skip to main content

IntoHttpResponse

Trait IntoHttpResponse 

Source
pub trait IntoHttpResponse {
    // Required method
    fn into_http_response(self) -> Response;
}
Expand description

Convenience trait that allows returning Result<T, FraiseQLError> from axum handlers by converting it directly into an HTTP Response.

Import this trait and call .into_http_response() on any Result<impl IntoResponse, FraiseQLError> value.

Required Methods§

Source

fn into_http_response(self) -> Response

Convert this result into an axum Response.

On success the inner value is serialised via its own IntoResponse implementation. On error the FraiseQLError is converted to a JSON error body with the appropriate HTTP status code.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> IntoHttpResponse for Result<T, FraiseQLError>
where T: IntoResponse,

Implementors§