macro_rules! impl_header(
($from:ident, $name:expr, $item:ty) => {
deref!($from => $item);
impl $crate::header::Header for $from {
fn header_name() -> &'static str {
$name
}
fn parse_header(raw: &[Vec<u8>]) -> Option<$from> {
$crate::header::parsing::from_one_raw_str(raw).map($from)
}
}
impl $crate::header::HeaderFormat for $from {
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
::std::fmt::Display::fmt(&**self, f)
}
}
impl ::std::fmt::Display for $from {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
use $crate::header::HeaderFormat;
self.fmt_header(f)
}
}
}
);