refactor(header): change Header::fmt_header to take a header::Formatter

The `header::Formatter` ensures that a formatted header is written to a
line, and allows for headers that require multiple lines. The only
header to specifically require this is `Set-Cookie`.

BREAKING CHANGE: The `fmt_header` method has changed to take a different
  formatter. In most cases, if your header also implements
  `fmt::Display`, you can just call `f.fmt_line(self)`.
This commit is contained in:
Sean McArthur
2017-04-20 23:01:25 -07:00
parent f1859dfd7a
commit 6f02d43ae0
24 changed files with 177 additions and 162 deletions

View File

@@ -190,8 +190,8 @@ impl Header for Range {
from_one_raw_str(raw)
}
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
Display::fmt(self, f)
fn fmt_header(&self, f: &mut ::header::Formatter) -> fmt::Result {
f.fmt_line(self)
}
}