hyper::impl_list_header! [-] [+] [src]

macro_rules! impl_list_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_comma_delimited(raw).map($from)
            }
        }

        impl $crate::header::HeaderFormat for $from {
            fn fmt_header(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                $crate::header::parsing::fmt_comma_delimited(fmt, &self[..])
            }
        }

        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)
            }
        }
    }
);