@@ -9,30 +9,35 @@ pub use endpoint::Endpoint;
9
9
#[ cfg( feature = "tls" ) ]
10
10
pub use tls:: ClientTlsConfig ;
11
11
12
- use super :: service:: { Connection , DynamicServiceStream } ;
12
+ use super :: service:: Connection ;
13
+ #[ cfg( feature = "transport" ) ]
14
+ use super :: service:: DynamicServiceStream ;
13
15
use crate :: body:: BoxBody ;
14
16
use bytes:: Bytes ;
15
17
use http:: {
16
18
uri:: { InvalidUri , Uri } ,
17
19
Request , Response ,
18
20
} ;
19
21
use hyper:: client:: connect:: Connection as HyperConnection ;
22
+ #[ cfg( feature = "transport" ) ]
23
+ use std:: hash:: Hash ;
20
24
use std:: {
21
25
fmt,
22
26
future:: Future ,
23
- hash:: Hash ,
24
27
pin:: Pin ,
25
28
task:: { Context , Poll } ,
26
29
} ;
27
- use tokio:: {
28
- io:: { AsyncRead , AsyncWrite } ,
29
- sync:: mpsc:: { channel, Sender } ,
30
- } ;
31
30
31
+ use tokio:: io:: { AsyncRead , AsyncWrite } ;
32
+ #[ cfg( feature = "transport" ) ]
33
+ use tokio:: sync:: mpsc:: { channel, Sender } ;
34
+
35
+ #[ cfg( feature = "transport" ) ]
32
36
use tower:: balance:: p2c:: Balance ;
37
+ #[ cfg( feature = "transport" ) ]
38
+ use tower:: discover:: { Change , Discover } ;
33
39
use tower:: {
34
40
buffer:: { self , Buffer } ,
35
- discover:: { Change , Discover } ,
36
41
util:: { BoxService , Either } ,
37
42
Service ,
38
43
} ;
@@ -108,6 +113,7 @@ impl Channel {
108
113
///
109
114
/// This creates a [`Channel`] that will load balance accross all the
110
115
/// provided endpoints.
116
+ #[ cfg( feature = "transport" ) ]
111
117
pub fn balance_list ( list : impl Iterator < Item = Endpoint > ) -> Self {
112
118
let ( channel, tx) = Self :: balance_channel ( DEFAULT_BUFFER_SIZE ) ;
113
119
list. for_each ( |endpoint| {
@@ -121,6 +127,7 @@ impl Channel {
121
127
/// Balance a list of [`Endpoint`]'s.
122
128
///
123
129
/// This creates a [`Channel`] that will listen to a stream of change events and will add or remove provided endpoints.
130
+ #[ cfg( feature = "transport" ) ]
124
131
pub fn balance_channel < K > ( capacity : usize ) -> ( Self , Sender < Change < K , Endpoint > > )
125
132
where
126
133
K : Hash + Eq + Send + Clone + ' static ,
@@ -130,6 +137,7 @@ impl Channel {
130
137
( Self :: balance ( list, DEFAULT_BUFFER_SIZE ) , tx)
131
138
}
132
139
140
+ #[ cfg( feature = "transport" ) ]
133
141
pub ( crate ) fn new < C > ( connector : C , endpoint : Endpoint ) -> Self
134
142
where
135
143
C : Service < Uri > + Send + ' static ,
@@ -162,6 +170,7 @@ impl Channel {
162
170
Ok ( Channel { svc } )
163
171
}
164
172
173
+ #[ cfg( feature = "transport" ) ]
165
174
pub ( crate ) fn balance < D > ( discover : D , buffer_size : usize ) -> Self
166
175
where
167
176
D : Discover < Service = Connection > + Unpin + Send + ' static ,
0 commit comments