@@ -25,9 +25,6 @@ use crate::{
2525 Protocol , Service ,
2626} ;
2727
28- #[ cfg( all( feature = "http-client-reqwest" , feature = "http-client-curl" ) ) ]
29- compile_error ! ( "Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive" ) ;
30-
3128#[ cfg( feature = "http-client-curl" ) ]
3229///
3330pub mod curl;
@@ -215,13 +212,6 @@ impl Default for Options {
215212 }
216213}
217214
218- /// The actual http client implementation, using curl
219- #[ cfg( feature = "http-client-curl" ) ]
220- pub type Impl = curl:: Curl ;
221- /// The actual http client implementation, using reqwest
222- #[ cfg( feature = "http-client-reqwest" ) ]
223- pub type Impl = reqwest:: Remote ;
224-
225215/// A transport for supporting arbitrary http clients by abstracting interactions with them into the [Http] trait.
226216pub struct Transport < H : Http > {
227217 url : String ,
@@ -270,13 +260,13 @@ impl<H: Http> Transport<H> {
270260}
271261
272262#[ cfg( any( feature = "http-client-curl" , feature = "http-client-reqwest" ) ) ]
273- impl Transport < Impl > {
263+ impl < H : Http + Default > Transport < H > {
274264 /// Create a new instance to communicate to `url` using the given `desired_version` of the `git` protocol.
275265 /// If `trace` is `true`, all packetlines received or sent will be passed to the facilities of the `gix-trace` crate.
276266 ///
277267 /// Note that the actual implementation depends on feature toggles.
278268 pub fn new ( url : gix_url:: Url , desired_version : Protocol , trace : bool ) -> Self {
279- Self :: new_http ( Impl :: default ( ) , url, desired_version, trace)
269+ Self :: new_http ( H :: default ( ) , url, desired_version, trace)
280270 }
281271}
282272
@@ -555,7 +545,7 @@ pub fn connect_http<H: Http>(http: H, url: gix_url::Url, desired_version: Protoc
555545/// Connect to the given `url` via HTTP/S using the `desired_version` of the `git` protocol.
556546/// If `trace` is `true`, all packetlines received or sent will be passed to the facilities of the `gix-trace` crate.
557547#[ cfg( any( feature = "http-client-curl" , feature = "http-client-reqwest" ) ) ]
558- pub fn connect ( url : gix_url:: Url , desired_version : Protocol , trace : bool ) -> Transport < Impl > {
548+ pub fn connect < H : Http + Default > ( url : gix_url:: Url , desired_version : Protocol , trace : bool ) -> Transport < H > {
559549 Transport :: new ( url, desired_version, trace)
560550}
561551
0 commit comments