Skip to main content

reply_with_status_and_json

Function reply_with_status_and_json 

Source
pub fn reply_with_status_and_json<T: Serialize>(
    status: Status,
    json: &T,
) -> Result<impl Reply + use<T>, Rejection>
Expand description

Serialises json as a JSON body, attaches the given HTTP status, and returns a result.

T must implement serde::Serialize. Equivalent to reply!(json => ..., status => ...).