use crate::http::{Method, MsgDataMut, Response, StatusCode};
#[derive(Debug)]
pub struct Request<MD> {
pub method: Method,
pub msg_data: MD,
}
impl<MD> Request<MD> {
#[inline]
pub const fn new(method: Method, msg_data: MD) -> Self {
Self { method, msg_data }
}
#[inline]
pub const fn http2(method: Method, msg_data: MD) -> Self {
Self { method, msg_data }
}
#[inline]
pub fn into_response(self, status_code: StatusCode) -> Response<MD> {
Response { msg_data: self.msg_data, status_code }
}
}
impl<MD> Request<MD>
where
MD: MsgDataMut,
{
#[inline]
pub fn clear(&mut self) {
self.msg_data.clear();
}
}