@@ -366,6 +366,15 @@ enum AsyncConnection {
366
366
Tls ( Box < tokio_rustls:: client:: TlsStream < tokio:: net:: TcpStream > > ) ,
367
367
}
368
368
369
+ #[ cfg( feature = "_async-sender" ) ]
370
+ enum AsyncProtocolHandler {
371
+ #[ cfg( feature = "async-sender-tcp" ) ]
372
+ AsyncTcp ( AsyncConnection ) ,
373
+
374
+ #[ cfg( feature = "async-sender-http" ) ]
375
+ AsyncHttp ( ) ,
376
+ }
377
+
369
378
#[ cfg( feature = "sync-sender-tcp" ) ]
370
379
impl SyncConnection {
371
380
fn send_key_id ( & mut self , key_id : & str ) -> Result < ( ) > {
@@ -431,18 +440,13 @@ impl SyncConnection {
431
440
}
432
441
}
433
442
434
- enum ProtocolHandler {
443
+ #[ cfg( feature = "_sync-sender" ) ]
444
+ enum SyncProtocolHandler {
435
445
#[ cfg( feature = "sync-sender-tcp" ) ]
436
446
SyncTcp ( SyncConnection ) ,
437
447
438
448
#[ cfg( feature = "sync-sender-http" ) ]
439
449
SyncHttp ( SyncHttpHandlerState ) ,
440
-
441
- #[ cfg( feature = "async-sender-tcp" ) ]
442
- AsyncTcp ( AsyncConnection ) ,
443
-
444
- #[ cfg( feature = "async-sender-http" ) ]
445
- AsyncHttp ( ) ,
446
450
}
447
451
448
452
#[ cfg( feature = "sync-sender-tcp" ) ]
@@ -1406,7 +1410,7 @@ impl Buffer {
1406
1410
/// * To send messages, call the [`flush`](Sender::flush) method.
1407
1411
pub struct Sender {
1408
1412
descr : String ,
1409
- handler : ProtocolHandler ,
1413
+ handler : SyncProtocolHandler ,
1410
1414
connected : bool ,
1411
1415
max_buf_size : usize ,
1412
1416
protocol_version : ProtocolVersion ,
@@ -2381,7 +2385,7 @@ impl SenderBuilder {
2381
2385
}
2382
2386
2383
2387
#[ cfg( feature = "sync-sender-tcp" ) ]
2384
- fn connect_tcp ( & self , auth : & Option < AuthParams > ) -> Result < ProtocolHandler > {
2388
+ fn connect_tcp ( & self , auth : & Option < AuthParams > ) -> Result < SyncProtocolHandler > {
2385
2389
let addr: SockAddr = gai:: resolve_host_port ( self . host . as_str ( ) , self . port . as_str ( ) ) ?;
2386
2390
let mut sock = Socket :: new ( Domain :: IPV4 , Type :: STREAM , Some ( SockProtocol :: TCP ) )
2387
2391
. map_err ( |io_err| map_io_to_socket_err ( "Could not open TCP socket: " , io_err) ) ?;
@@ -2470,7 +2474,7 @@ impl SenderBuilder {
2470
2474
conn. authenticate ( auth) ?;
2471
2475
}
2472
2476
2473
- Ok ( ProtocolHandler :: SyncTcp ( conn) )
2477
+ Ok ( SyncProtocolHandler :: SyncTcp ( conn) )
2474
2478
}
2475
2479
2476
2480
fn build_auth ( & self ) -> Result < Option < AuthParams > > {
@@ -2648,7 +2652,7 @@ impl SenderBuilder {
2648
2652
self . host. deref( ) ,
2649
2653
self . port. deref( )
2650
2654
) ;
2651
- ProtocolHandler :: SyncHttp ( SyncHttpHandlerState {
2655
+ SyncProtocolHandler :: SyncHttp ( SyncHttpHandlerState {
2652
2656
agent,
2653
2657
url,
2654
2658
auth,
@@ -2666,7 +2670,7 @@ impl SenderBuilder {
2666
2670
Protocol :: Tcp | Protocol :: Tcps => ProtocolVersion :: V1 ,
2667
2671
#[ cfg( feature = "sync-sender-http" ) ]
2668
2672
Protocol :: Http | Protocol :: Https => {
2669
- if let ProtocolHandler :: SyncHttp ( http_state) = & handler {
2673
+ if let SyncProtocolHandler :: SyncHttp ( http_state) = & handler {
2670
2674
let settings_url = & format ! (
2671
2675
"{}://{}:{}/settings" ,
2672
2676
self . protocol. schema( ) ,
@@ -2932,7 +2936,8 @@ impl Sender {
2932
2936
return Ok ( ( ) ) ;
2933
2937
}
2934
2938
match self . handler {
2935
- ProtocolHandler :: SyncTcp ( ref mut conn) => {
2939
+ #[ cfg( feature = "sync-sender-tcp" ) ]
2940
+ SyncProtocolHandler :: SyncTcp ( ref mut conn) => {
2936
2941
if transactional {
2937
2942
return Err ( error:: fmt!(
2938
2943
InvalidApiCall ,
@@ -2945,7 +2950,7 @@ impl Sender {
2945
2950
} ) ?;
2946
2951
}
2947
2952
#[ cfg( feature = "sync-sender-http" ) ]
2948
- ProtocolHandler :: SyncHttp ( ref state) => {
2953
+ SyncProtocolHandler :: SyncHttp ( ref state) => {
2949
2954
if transactional && !buf. transactional ( ) {
2950
2955
return Err ( error:: fmt!(
2951
2956
InvalidApiCall ,
0 commit comments