no_std_http/response.rs
1use crate::{header::HeaderMap, version::Version, StatusCode};
2
3/// Represents an HTTP response
4///
5/// An HTTP response consists of a head and a potentially optional body. The body
6/// component is generic, enabling arbitrary types to represent the HTTP body.
7/// For example, the body could be `Vec<u8>`, a `Stream` of byte chunks, or a
8/// value that has been deserialized.
9///
10/// Typically you'll work with responses on the client side as the result of
11/// sending a `Request` and on the server you'll be generating a `Response` to
12/// send back to the client.
13#[derive(Debug, Default, Clone)]
14pub struct Response<T> {
15 /// The response's status
16 pub status: StatusCode,
17
18 /// The response's version
19 pub version: Version,
20
21 /// The response's headers
22 pub headers: HeaderMap,
23
24 pub body: T,
25}