Skip to content

Commit 72e274c

Browse files
committed
refactor(header): add #[inline] to new header constructors
1 parent 0be0f26 commit 72e274c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/header/common/connection.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ header! {
7373

7474
impl Connection {
7575
/// A constructor to easily create a `Connection: close` header.
76+
#[inline]
7677
pub fn close() -> Connection {
7778
Connection(vec![ConnectionOption::Close])
7879
}
7980

8081
/// A constructor to easily create a `Connection: keep-alive` header.
82+
#[inline]
8183
pub fn keep_alive() -> Connection {
8284
Connection(vec![ConnectionOption::KeepAlive])
8385
}

src/header/common/content_type.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,31 @@ header! {
3636

3737
impl ContentType {
3838
/// A constructor to easily create a `Content-Type: application/json; charset=utf-8` header.
39+
#[inline]
3940
pub fn json() -> ContentType {
4041
ContentType(mime!(Application/Json; Charset=Utf8))
4142
}
4243

4344
/// A constructor to easily create a `Content-Type: text/plain; charset=utf-8` header.
45+
#[inline]
4446
pub fn plaintext() -> ContentType {
4547
ContentType(mime!(Text/Plain; Charset=Utf8))
4648
}
4749

4850
/// A constructor to easily create a `Content-Type: text/html; charset=utf-8` header.
51+
#[inline]
4952
pub fn html() -> ContentType {
5053
ContentType(mime!(Text/Html; Charset=Utf8))
5154
}
5255

5356
/// A constructor to easily create a `Content-Type: image/jpeg` header.
57+
#[inline]
5458
pub fn jpeg() -> ContentType {
5559
ContentType(mime!(Image/Jpeg))
5660
}
5761

5862
/// A constructor to easily create a `Content-Type: image/png` header.
63+
#[inline]
5964
pub fn png() -> ContentType {
6065
ContentType(mime!(Image/Png))
6166
}

0 commit comments

Comments
 (0)