feat(status): add StatusCode::try_from(u16).

This is a temporary function until the `TryFrom` trait stabilizes.

BREAKING CHANGE: Removes the undocumented `from_u16` function. Use
  `StatusCode::try_from` instead.

  Also makes the `status` module private. All imports of
  `hyper::status::StatusCode` should be `hyper::StatusCode`.
This commit is contained in:
Sean McArthur
2017-06-13 09:49:27 -07:00
parent c166268c07
commit f953cafe27
4 changed files with 44 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ impl RawStatus {
/// Converts this into a StatusCode.
#[inline]
pub fn status(&self) -> StatusCode {
StatusCode::from_u16(self.0)
StatusCode::try_from(self.0).unwrap()
}
}