Skip to content

Commit c934c0a

Browse files
committed
Restore client creation backwards-compatibility
Only provide RestClient::new and new_blocking for RestClient<GaiResolver>
1 parent b958711 commit c934c0a

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/lib.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,26 +306,32 @@ pub trait RestPath<T> {
306306
fn get_path(par: T) -> Result<String, Error>;
307307
}
308308

309-
impl<R> RestClient<R>
310-
where
311-
R: Service<dns::Name> + Send + Sync + Default + Clone + 'static,
312-
HttpsConnector<HttpConnector<R>>: hyper::client::connect::Connect,
313-
{
314-
/// Construct new client with default configuration to make HTTP requests.
309+
impl RestClient<GaiResolver> {
310+
/// Construct new client with default configuration and DNS resolver
311+
/// implementation to make HTTP requests.
315312
///
316-
/// Use `Builder` to configure the client.
317-
pub fn new(url: &str) -> Result<RestClient<R>, Error> {
318-
RestClient::<R>::with_builder(url, Self::builder())
313+
/// Use `Builder` to configure the client or to use a different
314+
/// resolver type.
315+
pub fn new(url: &str) -> Result<RestClient<GaiResolver>, Error> {
316+
RestClient::with_builder(url, Self::builder())
319317
}
320318

321-
/// Construct new blocking client with default configuration to make HTTP requests.
319+
/// Construct new blocking client with default configuration and DNS resolver
320+
/// implementation to make HTTP requests.
322321
///
323-
/// Use `Builder` to configure the client.
322+
/// Use `Builder` to configure the client or to use a different
323+
/// resolver type.
324324
#[cfg(feature = "blocking")]
325-
pub fn new_blocking(url: &str) -> Result<blocking::RestClient<R>, Error> {
325+
pub fn new_blocking(url: &str) -> Result<blocking::RestClient<GaiResolver>, Error> {
326326
RestClient::new(url).and_then(|client| client.try_into())
327327
}
328+
}
328329

330+
impl<R> RestClient<R>
331+
where
332+
R: Service<dns::Name> + Send + Sync + Default + Clone + 'static,
333+
HttpsConnector<HttpConnector<R>>: hyper::client::connect::Connect,
334+
{
329335
#[cfg(feature = "native-tls")]
330336
fn build_client() -> HyperClient<R>
331337
{

0 commit comments

Comments
 (0)