Skip to content

Commit 66371a0

Browse files
feat: const ::from_static() constructors (#209)
1 parent d425d3c commit 66371a0

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/common/referer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Referer {
4343
/// # Panic
4444
///
4545
/// Panics if the string is not a legal header value.
46-
pub fn from_static(s: &'static str) -> Referer {
46+
pub const fn from_static(s: &'static str) -> Referer {
4747
Referer(HeaderValueString::from_static(s))
4848
}
4949
}

src/common/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Server {
4343
/// # Panic
4444
///
4545
/// Panics if the static string is not a legal header value.
46-
pub fn from_static(s: &'static str) -> Server {
46+
pub const fn from_static(s: &'static str) -> Server {
4747
Server(HeaderValueString::from_static(s))
4848
}
4949

src/common/user_agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl UserAgent {
5252
/// # Panic
5353
///
5454
/// Panics if the static string is not a legal header value.
55-
pub fn from_static(src: &'static str) -> UserAgent {
55+
pub const fn from_static(src: &'static str) -> UserAgent {
5656
UserAgent(HeaderValueString::from_static(src))
5757
}
5858

src/util/value_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl HeaderValueString {
3535
.map(|value| HeaderValueString { value })
3636
}
3737

38-
pub(crate) fn from_static(src: &'static str) -> HeaderValueString {
38+
pub(crate) const fn from_static(src: &'static str) -> HeaderValueString {
3939
// A valid `str` (the argument)...
4040
HeaderValueString {
4141
value: HeaderValue::from_static(src),

0 commit comments

Comments
 (0)