@@ -372,6 +372,15 @@ enum AsyncConnection {
372
372
Tls ( Box < tokio_rustls:: client:: TlsStream < tokio:: net:: TcpStream > > ) ,
373
373
}
374
374
375
+ #[ cfg( feature = "_async-sender" ) ]
376
+ enum AsyncProtocolHandler {
377
+ #[ cfg( feature = "async-sender-tcp" ) ]
378
+ AsyncTcp ( AsyncConnection ) ,
379
+
380
+ #[ cfg( feature = "async-sender-http" ) ]
381
+ AsyncHttp ( ) ,
382
+ }
383
+
375
384
#[ cfg( feature = "sync-sender-tcp" ) ]
376
385
impl SyncConnection {
377
386
fn send_key_id ( & mut self , key_id : & str ) -> Result < ( ) > {
@@ -437,18 +446,13 @@ impl SyncConnection {
437
446
}
438
447
}
439
448
440
- enum ProtocolHandler {
449
+ #[ cfg( feature = "_sync-sender" ) ]
450
+ enum SyncProtocolHandler {
441
451
#[ cfg( feature = "sync-sender-tcp" ) ]
442
452
SyncTcp ( SyncConnection ) ,
443
453
444
454
#[ cfg( feature = "sync-sender-http" ) ]
445
455
SyncHttp ( SyncHttpHandlerState ) ,
446
-
447
- #[ cfg( feature = "async-sender-tcp" ) ]
448
- AsyncTcp ( AsyncConnection ) ,
449
-
450
- #[ cfg( feature = "async-sender-http" ) ]
451
- AsyncHttp ( ) ,
452
456
}
453
457
454
458
#[ cfg( feature = "sync-sender-tcp" ) ]
@@ -1412,7 +1416,7 @@ impl Buffer {
1412
1416
/// * To send messages, call the [`flush`](Sender::flush) method.
1413
1417
pub struct Sender {
1414
1418
descr : String ,
1415
- handler : ProtocolHandler ,
1419
+ handler : SyncProtocolHandler ,
1416
1420
connected : bool ,
1417
1421
max_buf_size : usize ,
1418
1422
protocol_version : ProtocolVersion ,
@@ -2387,7 +2391,7 @@ impl SenderBuilder {
2387
2391
}
2388
2392
2389
2393
#[ cfg( feature = "sync-sender-tcp" ) ]
2390
- fn connect_tcp ( & self , auth : & Option < AuthParams > ) -> Result < ProtocolHandler > {
2394
+ fn connect_tcp ( & self , auth : & Option < AuthParams > ) -> Result < SyncProtocolHandler > {
2391
2395
let addr: SockAddr = gai:: resolve_host_port ( self . host . as_str ( ) , self . port . as_str ( ) ) ?;
2392
2396
let mut sock = Socket :: new ( Domain :: IPV4 , Type :: STREAM , Some ( SockProtocol :: TCP ) )
2393
2397
. map_err ( |io_err| map_io_to_socket_err ( "Could not open TCP socket: " , io_err) ) ?;
@@ -2476,7 +2480,7 @@ impl SenderBuilder {
2476
2480
conn. authenticate ( auth) ?;
2477
2481
}
2478
2482
2479
- Ok ( ProtocolHandler :: SyncTcp ( conn) )
2483
+ Ok ( SyncProtocolHandler :: SyncTcp ( conn) )
2480
2484
}
2481
2485
2482
2486
fn build_auth ( & self ) -> Result < Option < AuthParams > > {
@@ -2654,7 +2658,7 @@ impl SenderBuilder {
2654
2658
self . host. deref( ) ,
2655
2659
self . port. deref( )
2656
2660
) ;
2657
- ProtocolHandler :: SyncHttp ( SyncHttpHandlerState {
2661
+ SyncProtocolHandler :: SyncHttp ( SyncHttpHandlerState {
2658
2662
agent,
2659
2663
url,
2660
2664
auth,
@@ -2672,7 +2676,7 @@ impl SenderBuilder {
2672
2676
Protocol :: Tcp | Protocol :: Tcps => ProtocolVersion :: V1 ,
2673
2677
#[ cfg( feature = "sync-sender-http" ) ]
2674
2678
Protocol :: Http | Protocol :: Https => {
2675
- if let ProtocolHandler :: SyncHttp ( http_state) = & handler {
2679
+ if let SyncProtocolHandler :: SyncHttp ( http_state) = & handler {
2676
2680
let settings_url = & format ! (
2677
2681
"{}://{}:{}/settings" ,
2678
2682
self . protocol. schema( ) ,
@@ -2938,7 +2942,8 @@ impl Sender {
2938
2942
return Ok ( ( ) ) ;
2939
2943
}
2940
2944
match self . handler {
2941
- ProtocolHandler :: SyncTcp ( ref mut conn) => {
2945
+ #[ cfg( feature = "sync-sender-tcp" ) ]
2946
+ SyncProtocolHandler :: SyncTcp ( ref mut conn) => {
2942
2947
if transactional {
2943
2948
return Err ( error:: fmt!(
2944
2949
InvalidApiCall ,
@@ -2951,7 +2956,7 @@ impl Sender {
2951
2956
} ) ?;
2952
2957
}
2953
2958
#[ cfg( feature = "sync-sender-http" ) ]
2954
- ProtocolHandler :: SyncHttp ( ref state) => {
2959
+ SyncProtocolHandler :: SyncHttp ( ref state) => {
2955
2960
if transactional && !buf. transactional ( ) {
2956
2961
return Err ( error:: fmt!(
2957
2962
InvalidApiCall ,
0 commit comments