File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ impl FromStr for HeaderName {
63
63
}
64
64
}
65
65
66
+ impl From < & HeaderName > for HeaderName {
67
+ fn from ( value : & HeaderName ) -> HeaderName {
68
+ value. clone ( )
69
+ }
70
+ }
71
+
66
72
impl < ' a > From < & ' a str > for HeaderName {
67
73
fn from ( value : & ' a str ) -> Self {
68
74
Self :: from_str ( value) . unwrap ( )
@@ -134,4 +140,10 @@ mod tests {
134
140
// Must validate regardless of casing.
135
141
assert_eq ! ( static_header, & String :: from( "Hello" ) ) ;
136
142
}
143
+
144
+ #[ test]
145
+ fn pass_name_by_ref ( ) {
146
+ let mut res = crate :: Response :: new ( 200 ) ;
147
+ res. insert_header ( & crate :: headers:: HOST , "127.0.0.1" ) ;
148
+ }
137
149
}
Original file line number Diff line number Diff line change
1
+ use std:: convert:: TryFrom ;
1
2
use std:: fmt:: { self , Display } ;
2
3
use std:: str:: FromStr ;
3
4
@@ -83,7 +84,7 @@ impl FromStr for HeaderValue {
83
84
}
84
85
}
85
86
86
- impl < ' a > std :: convert :: TryFrom < & ' a str > for HeaderValue {
87
+ impl < ' a > TryFrom < & ' a str > for HeaderValue {
87
88
type Error = Error ;
88
89
89
90
fn try_from ( value : & ' a str ) -> Result < Self , Self :: Error > {
You can’t perform that action at this time.
0 commit comments