Commit b6dde67 1 parent e8b6076 commit b6dde67 Copy full SHA for b6dde67
File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,12 @@ pub struct ParseMethodError;
316
316
317
317
impl std:: error:: Error for ParseMethodError { }
318
318
319
+ impl From < std:: convert:: Infallible > for ParseMethodError {
320
+ fn from ( infallible : std:: convert:: Infallible ) -> Self {
321
+ match infallible { }
322
+ }
323
+ }
324
+
319
325
impl fmt:: Display for ParseMethodError {
320
326
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
321
327
f. write_str ( "invalid HTTP method" )
@@ -331,6 +337,14 @@ impl FromStr for Method {
331
337
}
332
338
}
333
339
340
+ impl TryFrom < & str > for Method {
341
+ type Error = ParseMethodError ;
342
+
343
+ fn try_from ( s : & str ) -> Result < Self , Self :: Error > {
344
+ Self :: try_from ( s. as_bytes ( ) )
345
+ }
346
+ }
347
+
334
348
impl AsRef < str > for Method {
335
349
fn as_ref ( & self ) -> & str {
336
350
self . as_str ( )
You can’t perform that action at this time.
0 commit comments