Function got_ya_id::core::response::respond2 [−][src]
pub fn respond2<'c, T, H: BuildHasher>(
data: HashMap<&'c str, &'c str, H>,
body: Option<T>
) -> HttpResponse where
T: DeserializeOwned,
T: Serialize,
Constructs a HttpResponse
Like respond
but not returning a Result
and has no err
argument.
This is meant to be a replacement for respond
Calling respond
with an error requires a type declaration,
but the aim of this was to provide SIMPLICITY in making
http responses.
Arguments
data: Hashmap<&’static str, &’static str>
message: Response message during 2** status (Success) response Ignored for Error responses status: Status code. e.g “200”
body: T
The data to be contained in the success reponse It ought to be JSON Serializable
Returns
HttpResponse