feat(header): implement fmt::Display for several headers

Specifically, `CacheControl`, `Expect`, `Origin`, `Pragma`, `Prefer`,
`PreferenceApplied`, `ReferrerPolicy`, `StrictTransportSecurity`.
This commit is contained in:
Sean McArthur
2017-01-31 13:25:33 -08:00
parent b4b2fb782e
commit e9e7381ece
11 changed files with 77 additions and 17 deletions

View File

@@ -59,7 +59,7 @@ impl Header for Origin {
}
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}://{}", self.scheme, self.host)
fmt::Display::fmt(self, f)
}
}
@@ -83,6 +83,12 @@ impl FromStr for Origin {
}
}
impl fmt::Display for Origin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}://{}", self.scheme, self.host)
}
}
impl PartialEq for Origin {
fn eq(&self, other: &Origin) -> bool {
self.scheme == other.scheme && self.host == other.host