#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Entry<H, T> {
header: H,
body: T,
}
impl<H, T> Entry<H, T> {
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn new(header: H, body: T) -> Self {
Self { header, body }
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn header(&self) -> H
where
H: Copy,
{
self.header
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn header_ref(&self) -> &H {
&self.header
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn header_mut(&mut self) -> &mut H {
&mut self.header
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub fn with_header(mut self, header: H) -> Self {
self.set_header(header);
self
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub fn set_header(&mut self, header: H) -> &mut Self {
self.header = header;
self
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn body(&self) -> T
where
T: Copy,
{
self.body
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn body_ref(&self) -> &T {
&self.body
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub const fn body_mut(&mut self) -> &mut T {
&mut self.body
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub fn with_body(mut self, body: T) -> Self {
self.set_body(body);
self
}
#[cfg_attr(not(tarpaulin), inline(always))]
pub fn set_body(&mut self, body: T) -> &mut Self {
self.body = body;
self
}
}