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