1+ use std:: { fmt, future:: Future , net:: IpAddr , pin:: Pin , str, str:: FromStr , time:: Duration } ;
2+
3+ use bytes:: Bytes ;
4+ #[ cfg( feature = "user-agent" ) ]
5+ use http:: uri:: HeaderValue ;
6+ use http:: uri:: Uri ;
7+ use hyper:: rt;
8+ use hyper_util:: client:: legacy:: connect:: HttpConnector ;
9+ use tower_service:: Service ;
10+
111#[ cfg( feature = "_tls-any" ) ]
212use super :: service:: TlsConnector ;
3- use super :: service:: { self , Executor , SharedExec } ;
4- use super :: uds_connector:: UdsConnector ;
5- use super :: Channel ;
613#[ cfg( feature = "_tls-any" ) ]
714use super :: ClientTlsConfig ;
15+ use super :: {
16+ service:: { self , Executor , SharedExec } ,
17+ uds_connector:: UdsConnector ,
18+ Channel ,
19+ } ;
820#[ cfg( feature = "_tls-any" ) ]
921use crate :: transport:: error;
1022use crate :: transport:: Error ;
11- use bytes:: Bytes ;
12- use http:: { uri:: Uri , HeaderValue } ;
13- use hyper:: rt;
14- use hyper_util:: client:: legacy:: connect:: HttpConnector ;
15- use std:: { fmt, future:: Future , net:: IpAddr , pin:: Pin , str, str:: FromStr , time:: Duration } ;
16- use tower_service:: Service ;
1723
1824#[ derive( Clone , PartialEq , Eq , Hash ) ]
1925pub ( crate ) enum EndpointType {
@@ -29,6 +35,7 @@ pub struct Endpoint {
2935 pub ( crate ) uri : EndpointType ,
3036 fallback_uri : Uri ,
3137 pub ( crate ) origin : Option < Uri > ,
38+ #[ cfg( feature = "user-agent" ) ]
3239 pub ( crate ) user_agent : Option < HeaderValue > ,
3340 pub ( crate ) timeout : Option < Duration > ,
3441 pub ( crate ) concurrency_limit : Option < usize > ,
@@ -76,6 +83,7 @@ impl Endpoint {
7683 uri : EndpointType :: Uri ( uri. clone ( ) ) ,
7784 fallback_uri : uri,
7885 origin : None ,
86+ #[ cfg( feature = "user-agent" ) ]
7987 user_agent : None ,
8088 concurrency_limit : None ,
8189 rate_limit : None ,
@@ -105,6 +113,7 @@ impl Endpoint {
105113 uri : EndpointType :: Uds ( uds_filepath. to_string ( ) ) ,
106114 fallback_uri : Uri :: from_static ( "http://tonic" ) ,
107115 origin : None ,
116+ #[ cfg( feature = "user-agent" ) ]
108117 user_agent : None ,
109118 concurrency_limit : None ,
110119 rate_limit : None ,
@@ -185,6 +194,7 @@ impl Endpoint {
185194 /// builder.user_agent("Greeter").expect("Greeter should be a valid header value");
186195 /// // user-agent: "Greeter tonic/x.x.x"
187196 /// ```
197+ #[ cfg( feature = "user-agent" ) ]
188198 pub fn user_agent < T > ( self , user_agent : T ) -> Result < Self , Error >
189199 where
190200 T : TryInto < HeaderValue > ,
0 commit comments