diff --git a/src/status.rs b/src/status.rs index c46fd9b305..9589cf9de8 100644 --- a/src/status.rs +++ b/src/status.rs @@ -1,6 +1,7 @@ //! HTTP status codes use std::fmt; use std::cmp::Ordering; +use std::hash::{Hash, Hasher}; // shamelessly lifted from Teepee. I tried a few schemes, this really // does seem like the best. Improved scheme to support arbitrary status codes. @@ -533,6 +534,12 @@ impl Ord for StatusCode { } } +impl Hash for StatusCode { + fn hash(&self, state: &mut H) { + self.to_u16().hash(state); + } +} + /// The class of an HTTP `status-code`. /// /// [RFC 7231, section 6 (Response Status Codes)](https://tools.ietf.org/html/rfc7231#section-6):