53
53
//! ```
54
54
55
55
use std:: any:: Any ;
56
- use std:: convert:: TryFrom ;
56
+ use std:: convert:: TryInto ;
57
57
use std:: fmt;
58
58
59
59
use crate :: header:: { HeaderMap , HeaderName , HeaderValue } ;
@@ -231,8 +231,8 @@ impl Request<()> {
231
231
/// ```
232
232
pub fn get < T > ( uri : T ) -> Builder
233
233
where
234
- Uri : TryFrom < T > ,
235
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
234
+ T : TryInto < Uri > ,
235
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
236
236
{
237
237
Builder :: new ( ) . method ( Method :: GET ) . uri ( uri)
238
238
}
@@ -253,8 +253,8 @@ impl Request<()> {
253
253
/// ```
254
254
pub fn put < T > ( uri : T ) -> Builder
255
255
where
256
- Uri : TryFrom < T > ,
257
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
256
+ T : TryInto < Uri > ,
257
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
258
258
{
259
259
Builder :: new ( ) . method ( Method :: PUT ) . uri ( uri)
260
260
}
@@ -275,8 +275,8 @@ impl Request<()> {
275
275
/// ```
276
276
pub fn post < T > ( uri : T ) -> Builder
277
277
where
278
- Uri : TryFrom < T > ,
279
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
278
+ T : TryInto < Uri > ,
279
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
280
280
{
281
281
Builder :: new ( ) . method ( Method :: POST ) . uri ( uri)
282
282
}
@@ -297,8 +297,8 @@ impl Request<()> {
297
297
/// ```
298
298
pub fn delete < T > ( uri : T ) -> Builder
299
299
where
300
- Uri : TryFrom < T > ,
301
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
300
+ T : TryInto < Uri > ,
301
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
302
302
{
303
303
Builder :: new ( ) . method ( Method :: DELETE ) . uri ( uri)
304
304
}
@@ -320,8 +320,8 @@ impl Request<()> {
320
320
/// ```
321
321
pub fn options < T > ( uri : T ) -> Builder
322
322
where
323
- Uri : TryFrom < T > ,
324
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
323
+ T : TryInto < Uri > ,
324
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
325
325
{
326
326
Builder :: new ( ) . method ( Method :: OPTIONS ) . uri ( uri)
327
327
}
@@ -342,8 +342,8 @@ impl Request<()> {
342
342
/// ```
343
343
pub fn head < T > ( uri : T ) -> Builder
344
344
where
345
- Uri : TryFrom < T > ,
346
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
345
+ T : TryInto < Uri > ,
346
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
347
347
{
348
348
Builder :: new ( ) . method ( Method :: HEAD ) . uri ( uri)
349
349
}
@@ -364,8 +364,8 @@ impl Request<()> {
364
364
/// ```
365
365
pub fn connect < T > ( uri : T ) -> Builder
366
366
where
367
- Uri : TryFrom < T > ,
368
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
367
+ T : TryInto < Uri > ,
368
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
369
369
{
370
370
Builder :: new ( ) . method ( Method :: CONNECT ) . uri ( uri)
371
371
}
@@ -386,8 +386,8 @@ impl Request<()> {
386
386
/// ```
387
387
pub fn patch < T > ( uri : T ) -> Builder
388
388
where
389
- Uri : TryFrom < T > ,
390
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
389
+ T : TryInto < Uri > ,
390
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
391
391
{
392
392
Builder :: new ( ) . method ( Method :: PATCH ) . uri ( uri)
393
393
}
@@ -408,8 +408,8 @@ impl Request<()> {
408
408
/// ```
409
409
pub fn trace < T > ( uri : T ) -> Builder
410
410
where
411
- Uri : TryFrom < T > ,
412
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
411
+ T : TryInto < Uri > ,
412
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
413
413
{
414
414
Builder :: new ( ) . method ( Method :: TRACE ) . uri ( uri)
415
415
}
@@ -767,11 +767,11 @@ impl Builder {
767
767
/// ```
768
768
pub fn method < T > ( self , method : T ) -> Builder
769
769
where
770
- Method : TryFrom < T > ,
771
- <Method as TryFrom < T > >:: Error : Into < crate :: Error > ,
770
+ T : TryInto < Method > ,
771
+ <T as TryInto < Method > >:: Error : Into < crate :: Error > ,
772
772
{
773
773
self . and_then ( move |mut head| {
774
- let method = TryFrom :: try_from ( method) . map_err ( Into :: into) ?;
774
+ let method = method. try_into ( ) . map_err ( Into :: into) ?;
775
775
head. method = method;
776
776
Ok ( head)
777
777
} )
@@ -812,11 +812,11 @@ impl Builder {
812
812
/// ```
813
813
pub fn uri < T > ( self , uri : T ) -> Builder
814
814
where
815
- Uri : TryFrom < T > ,
816
- <Uri as TryFrom < T > >:: Error : Into < crate :: Error > ,
815
+ T : TryInto < Uri > ,
816
+ <T as TryInto < Uri > >:: Error : Into < crate :: Error > ,
817
817
{
818
818
self . and_then ( move |mut head| {
819
- head. uri = TryFrom :: try_from ( uri) . map_err ( Into :: into) ?;
819
+ head. uri = uri. try_into ( ) . map_err ( Into :: into) ?;
820
820
Ok ( head)
821
821
} )
822
822
}
@@ -900,14 +900,14 @@ impl Builder {
900
900
/// ```
901
901
pub fn header < K , V > ( self , key : K , value : V ) -> Builder
902
902
where
903
- HeaderName : TryFrom < K > ,
904
- <HeaderName as TryFrom < K > >:: Error : Into < crate :: Error > ,
905
- HeaderValue : TryFrom < V > ,
906
- <HeaderValue as TryFrom < V > >:: Error : Into < crate :: Error > ,
903
+ K : TryInto < HeaderName > ,
904
+ <K as TryInto < HeaderName > >:: Error : Into < crate :: Error > ,
905
+ V : TryInto < HeaderValue > ,
906
+ <V as TryInto < HeaderValue > >:: Error : Into < crate :: Error > ,
907
907
{
908
908
self . and_then ( move |mut head| {
909
- let name = < HeaderName as TryFrom < K > > :: try_from ( key) . map_err ( Into :: into) ?;
910
- let value = < HeaderValue as TryFrom < V > > :: try_from ( value) . map_err ( Into :: into) ?;
909
+ let name = key. try_into ( ) . map_err ( Into :: into) ?;
910
+ let value = value. try_into ( ) . map_err ( Into :: into) ?;
911
911
head. headers . try_append ( name, value) ?;
912
912
Ok ( head)
913
913
} )
0 commit comments