diff --git a/src/header/mod.rs b/src/header/mod.rs index 41c07abd..3588b2d5 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -423,6 +423,19 @@ impl hash::Hash for CaseInsensitive { } } +/// A wrapper around any Header with a Show impl that calls fmt_header. +/// +/// This can be used like so: `format!("{}", ShowHeader(header))` to +/// get the representation of a Header which will be written to an +/// outgoing TcpStream. +pub struct HeaderFormatter(H); + +impl Show for HeaderFormatter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.fmt_header(f) + } +} + #[cfg(test)] mod tests { use std::io::MemReader;