use crate::http::{Headers, MsgData, StatusCode};
#[derive(Debug)]
pub struct Response<MD> {
pub msg_data: MD,
pub status_code: StatusCode,
}
impl<MD> Response<MD> {
#[inline]
pub const fn new(msg_data: MD, status_code: StatusCode) -> Self {
Self { msg_data, status_code }
}
#[inline]
pub const fn http2(data: MD, status_code: StatusCode) -> Self {
Self { msg_data: data, status_code }
}
}
impl<MD> Response<MD>
where
MD: MsgData,
{
#[inline]
pub fn body(&self) -> &MD::Body {
self.msg_data.body()
}
#[inline]
pub fn headers(&self) -> &Headers {
self.msg_data.headers()
}
}