@@ -44,54 +44,54 @@ pub struct ContentType(Mime);
44
44
impl ContentType {
45
45
/// A constructor to easily create a `Content-Type: application/json` header.
46
46
#[ inline]
47
- pub fn json ( ) -> ContentType {
47
+ pub const fn json ( ) -> ContentType {
48
48
ContentType ( mime:: APPLICATION_JSON )
49
49
}
50
50
51
51
/// A constructor to easily create a `Content-Type: text/plain` header.
52
52
#[ inline]
53
- pub fn text ( ) -> ContentType {
53
+ pub const fn text ( ) -> ContentType {
54
54
ContentType ( mime:: TEXT_PLAIN )
55
55
}
56
56
57
57
/// A constructor to easily create a `Content-Type: text/plain; charset=utf-8` header.
58
58
#[ inline]
59
- pub fn text_utf8 ( ) -> ContentType {
59
+ pub const fn text_utf8 ( ) -> ContentType {
60
60
ContentType ( mime:: TEXT_PLAIN_UTF_8 )
61
61
}
62
62
63
63
/// A constructor to easily create a `Content-Type: text/html` header.
64
64
#[ inline]
65
- pub fn html ( ) -> ContentType {
65
+ pub const fn html ( ) -> ContentType {
66
66
ContentType ( mime:: TEXT_HTML )
67
67
}
68
68
69
69
/// A constructor to easily create a `Content-Type: text/xml` header.
70
70
#[ inline]
71
- pub fn xml ( ) -> ContentType {
71
+ pub const fn xml ( ) -> ContentType {
72
72
ContentType ( mime:: TEXT_XML )
73
73
}
74
74
75
75
/// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header.
76
76
#[ inline]
77
- pub fn form_url_encoded ( ) -> ContentType {
77
+ pub const fn form_url_encoded ( ) -> ContentType {
78
78
ContentType ( mime:: APPLICATION_WWW_FORM_URLENCODED )
79
79
}
80
80
/// A constructor to easily create a `Content-Type: image/jpeg` header.
81
81
#[ inline]
82
- pub fn jpeg ( ) -> ContentType {
82
+ pub const fn jpeg ( ) -> ContentType {
83
83
ContentType ( mime:: IMAGE_JPEG )
84
84
}
85
85
86
86
/// A constructor to easily create a `Content-Type: image/png` header.
87
87
#[ inline]
88
- pub fn png ( ) -> ContentType {
88
+ pub const fn png ( ) -> ContentType {
89
89
ContentType ( mime:: IMAGE_PNG )
90
90
}
91
91
92
92
/// A constructor to easily create a `Content-Type: application/octet-stream` header.
93
93
#[ inline]
94
- pub fn octet_stream ( ) -> ContentType {
94
+ pub const fn octet_stream ( ) -> ContentType {
95
95
ContentType ( mime:: APPLICATION_OCTET_STREAM )
96
96
}
97
97
}
0 commit comments