File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use regex::Regex;
16
16
use serde:: Serialize ;
17
17
use serde_json:: Value ;
18
18
use std:: convert:: TryInto ;
19
- use std:: str;
19
+ use std:: str:: { self , FromStr } ;
20
20
use url:: Url ;
21
21
22
22
/// Implement the `Match` trait for all closures, out of the box,
@@ -65,20 +65,17 @@ pub struct MethodExactMatcher(Method);
65
65
/// Shorthand for [`MethodExactMatcher::new`].
66
66
pub fn method < T > ( method : T ) -> MethodExactMatcher
67
67
where
68
- T : TryInto < Method > ,
69
- <T as TryInto < Method > >:: Error : std:: fmt:: Debug ,
68
+ T : AsRef < str > ,
70
69
{
71
70
MethodExactMatcher :: new ( method)
72
71
}
73
72
74
73
impl MethodExactMatcher {
75
74
pub fn new < T > ( method : T ) -> Self
76
75
where
77
- T : TryInto < Method > ,
78
- <T as TryInto < Method > >:: Error : std:: fmt:: Debug ,
76
+ T : AsRef < str > ,
79
77
{
80
- let method = method
81
- . try_into ( )
78
+ let method = Method :: from_str ( & method. as_ref ( ) . to_ascii_uppercase ( ) )
82
79
. expect ( "Failed to convert to HTTP method." ) ;
83
80
Self ( method)
84
81
}
You can’t perform that action at this time.
0 commit comments