Skip to content

Commit 072fd8a

Browse files
authored
feat: make StatusCode::as_u16 a const fn (#680)
1 parent 2c8db78 commit 072fd8a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/status.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ impl StatusCode {
116116
/// assert_eq!(status.as_u16(), 200);
117117
/// ```
118118
#[inline]
119-
pub fn as_u16(&self) -> u16 {
120-
(*self).into()
119+
pub const fn as_u16(&self) -> u16 {
120+
(*self).0.get()
121121
}
122122

123123
/// Returns a &str representation of the `StatusCode`

src/uri/port.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<T> Port<T> {
2222
/// let port = authority.port().unwrap();
2323
/// assert_eq!(port.as_u16(), 80);
2424
/// ```
25-
pub fn as_u16(&self) -> u16 {
25+
pub const fn as_u16(&self) -> u16 {
2626
self.port
2727
}
2828
}

0 commit comments

Comments
 (0)