11pub  use  crate :: client:: non_io_types:: connect:: { Error ,  Options } ; 
22
3- #[ cfg( feature = "async-std" ) ]  
43pub ( crate )  mod  function { 
5-     use  crate :: client:: { git ,   non_io_types:: connect:: Error } ; 
4+     use  crate :: client:: non_io_types:: connect:: Error ; 
65
76    /// A general purpose connector connecting to a repository identified by the given `url`. 
87     /// 
98     /// This includes connections to 
10-      /// [git daemons][crate::client::git::connect()] only at the moment.  
9+      /// [git daemons][crate::client::git::connect()] and `ssh`,  
1110     /// 
1211     /// Use `options` to further control specifics of the transport resulting from the connection. 
1312     pub  async  fn  connect < Url ,  E > ( 
@@ -18,28 +17,30 @@ pub(crate) mod function {
1817        Url :  TryInto < gix_url:: Url ,  Error  = E > , 
1918        gix_url:: parse:: Error :  From < E > , 
2019    { 
21-         let  mut   url = url. try_into ( ) . map_err ( gix_url:: parse:: Error :: from) ?; 
20+         let  url = url. try_into ( ) . map_err ( gix_url:: parse:: Error :: from) ?; 
2221        Ok ( match  url. scheme  { 
22+             #[ cfg( feature = "async-std" ) ]  
2323            gix_url:: Scheme :: Git  => { 
2424                if  url. user ( ) . is_some ( )  { 
2525                    return  Err ( Error :: UnsupportedUrlTokens  { 
2626                        url :  url. to_bstring ( ) , 
2727                        scheme :  url. scheme , 
2828                    } ) ; 
2929                } 
30-                  let  path = std :: mem :: take ( & mut  url . path ) ; 
30+ 
3131                Box :: new ( 
32-                     git:: Connection :: new_tcp ( 
32+                     crate :: client :: git:: Connection :: new_tcp ( 
3333                        url. host ( ) . expect ( "host is present in url" ) , 
3434                        url. port , 
35-                         path, 
35+                         url . path . clone ( ) , 
3636                        options. version , 
3737                        options. trace , 
3838                    ) 
3939                    . await 
4040                    . map_err ( |e| Box :: new ( e)  as  Box < dyn  std:: error:: Error  + Send  + Sync > ) ?, 
4141                ) 
4242            } 
43+             #[ cfg( feature = "russh" ) ]  
4344            gix_url:: Scheme :: Ssh  => { 
4445                Box :: new ( crate :: client:: async_io:: ssh:: connect ( url,  options. version ,  options. trace ) . await ?) 
4546            } 
0 commit comments