refactor(header): add #[inline] to new header constructors

This commit is contained in:
Sean McArthur
2015-05-12 18:23:55 -07:00
parent 0be0f264af
commit 72e274c52a
2 changed files with 7 additions and 0 deletions

View File

@@ -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])
}

View File

@@ -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))
}