leda/gemini/
response.rs

1use super::header;
2
3/// Represents a response generated from a gemini server.
4#[derive(Clone)]
5pub struct Response {
6    /// The header the server responded with, includes the response status code as well as the meta
7    /// information provided.
8    pub header: header::Header,
9    /// The response body content from the server. `body` will only be `Some` if the header's
10    /// [`header::Header::status`] is [`header::StatusCode::Success`], otherwise it'll be `None`.
11    pub body: Option<Vec<u8>>,
12}
13
14impl Response {
15    #[must_use]
16    pub fn new(header: header::Header, body: Option<Vec<u8>>) -> Response {
17        Response { header, body }
18    }
19}