Skip to content

Commit

Permalink
feat: make StatusCode::as_u16 a const fn (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyNotHugo authored Dec 3, 2024
1 parent 2c8db78 commit 072fd8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ impl StatusCode {
/// assert_eq!(status.as_u16(), 200);
/// ```
#[inline]
pub fn as_u16(&self) -> u16 {
(*self).into()
pub const fn as_u16(&self) -> u16 {
(*self).0.get()
}

/// Returns a &str representation of the `StatusCode`
Expand Down
2 changes: 1 addition & 1 deletion src/uri/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<T> Port<T> {
/// let port = authority.port().unwrap();
/// assert_eq!(port.as_u16(), 80);
/// ```
pub fn as_u16(&self) -> u16 {
pub const fn as_u16(&self) -> u16 {
self.port
}
}
Expand Down

0 comments on commit 072fd8a

Please sign in to comment.