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