88//! The [`Client`] can also be used with [`Discovery`](crate::Discovery) to dynamically
99//! retrieve the resources served by the kubernetes API.
1010use either:: { Either , Left , Right } ;
11- use futures:: { AsyncBufRead , StreamExt , TryStream , TryStreamExt } ;
11+ use futures:: { future :: BoxFuture , AsyncBufRead , StreamExt , TryStream , TryStreamExt } ;
1212use http:: { self , Request , Response } ;
1313use http_body_util:: BodyExt ;
1414#[ cfg( feature = "ws" ) ] use hyper_util:: rt:: TokioIo ;
@@ -75,8 +75,8 @@ pub use builder::{ClientBuilder, DynBody};
7575#[ derive( Clone ) ]
7676pub struct Client {
7777 // - `Buffer` for cheap clone
78- // - `BoxService ` for dynamic response future type
79- inner : Buffer < BoxService < Request < Body > , Response < Body > , BoxError > , Request < Body > > ,
78+ // - `BoxFuture ` for dynamic response future type
79+ inner : Buffer < Request < Body > , BoxFuture < ' static , Result < Response < Body > , BoxError > > > ,
8080 default_ns : String ,
8181}
8282
@@ -102,13 +102,14 @@ impl Client {
102102 /// ```rust
103103 /// # async fn doc() -> Result<(), Box<dyn std::error::Error>> {
104104 /// use kube::{client::ConfigExt, Client, Config};
105- /// use tower::ServiceBuilder;
105+ /// use tower::{BoxError, ServiceBuilder} ;
106106 /// use hyper_util::rt::TokioExecutor;
107107 ///
108108 /// let config = Config::infer().await?;
109109 /// let service = ServiceBuilder::new()
110110 /// .layer(config.base_uri_layer())
111111 /// .option_layer(config.auth_layer()?)
112+ /// .map_err(BoxError::from)
112113 /// .service(hyper_util::client::legacy::Client::builder(TokioExecutor::new()).build_http());
113114 /// let client = Client::new(service, config.default_namespace);
114115 /// # Ok(())
0 commit comments