diff --git a/src/status.rs b/src/status.rs index 53490f3..9df1de4 100644 --- a/src/status.rs +++ b/src/status.rs @@ -61,6 +61,11 @@ impl StatusCode { Ok(StatusCode(status)) } + /// Returns the u16 corresponding to this status code + pub fn as_u16(&self) -> u16 { + (*self).into() + } + /// Check if class is Informational. pub fn is_informational(&self) -> bool { 200 > self.0 && self.0 >= 100 diff --git a/src/uri.rs b/src/uri.rs index 4be5fe1..aeae678 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -711,6 +711,11 @@ impl Scheme { None => unreachable!(), } } + + /// Converts this `Scheme` back to a sequence of bytes + pub fn into_bytes(self) -> Bytes { + self.into() + } } impl FromStr for Scheme { @@ -922,6 +927,11 @@ impl Authority { pub fn as_str(&self) -> &str { &self.data[..] } + + /// Converts this `Authority` back to a sequence of bytes + pub fn into_bytes(self) -> Bytes { + self.into() + } } impl FromStr for Authority { @@ -1096,6 +1106,11 @@ impl OriginForm { Some(&self.data[i as usize..]) } } + + /// Converts this `OriginForm` back to a sequence of bytes + pub fn into_bytes(self) -> Bytes { + self.into() + } } impl FromStr for OriginForm {