refactor(header): add #[inline] to new header constructors
This commit is contained in:
@@ -73,11 +73,13 @@ header! {
|
||||
|
||||
impl Connection {
|
||||
/// A constructor to easily create a `Connection: close` header.
|
||||
#[inline]
|
||||
pub fn close() -> Connection {
|
||||
Connection(vec![ConnectionOption::Close])
|
||||
}
|
||||
|
||||
/// A constructor to easily create a `Connection: keep-alive` header.
|
||||
#[inline]
|
||||
pub fn keep_alive() -> Connection {
|
||||
Connection(vec![ConnectionOption::KeepAlive])
|
||||
}
|
||||
|
||||
@@ -36,26 +36,31 @@ header! {
|
||||
|
||||
impl ContentType {
|
||||
/// A constructor to easily create a `Content-Type: application/json; charset=utf-8` header.
|
||||
#[inline]
|
||||
pub fn json() -> ContentType {
|
||||
ContentType(mime!(Application/Json; Charset=Utf8))
|
||||
}
|
||||
|
||||
/// A constructor to easily create a `Content-Type: text/plain; charset=utf-8` header.
|
||||
#[inline]
|
||||
pub fn plaintext() -> ContentType {
|
||||
ContentType(mime!(Text/Plain; Charset=Utf8))
|
||||
}
|
||||
|
||||
/// A constructor to easily create a `Content-Type: text/html; charset=utf-8` header.
|
||||
#[inline]
|
||||
pub fn html() -> ContentType {
|
||||
ContentType(mime!(Text/Html; Charset=Utf8))
|
||||
}
|
||||
|
||||
/// A constructor to easily create a `Content-Type: image/jpeg` header.
|
||||
#[inline]
|
||||
pub fn jpeg() -> ContentType {
|
||||
ContentType(mime!(Image/Jpeg))
|
||||
}
|
||||
|
||||
/// A constructor to easily create a `Content-Type: image/png` header.
|
||||
#[inline]
|
||||
pub fn png() -> ContentType {
|
||||
ContentType(mime!(Image/Png))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user