chore(client): place the use of new rust features behind cfg

This commit is contained in:
Niv Kaminer
2018-08-04 10:21:57 +03:00
committed by Sean McArthur
parent 97f4243a59
commit 9f8add6056
5 changed files with 83 additions and 1 deletions

View File

@@ -623,6 +623,7 @@ impl<B> PoolClient<B> {
}
impl<B: Payload + 'static> PoolClient<B> {
#[cfg(impl_trait_available)]
fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item = Response<Body>, Error = (::Error, Option<Request<B>>)> + Send
where
B: Send,
@@ -632,6 +633,17 @@ impl<B: Payload + 'static> PoolClient<B> {
PoolTx::Http2(ref mut tx) => Either::B(tx.send_request_retryable(req)),
}
}
#[cfg(not(impl_trait_available))]
fn send_request_retryable(&mut self, req: Request<B>) -> Box<Future<Item=Response<Body>, Error=(::Error, Option<Request<B>>)> + Send>
where
B: Send,
{
match self.tx {
PoolTx::Http1(ref mut tx) => tx.send_request_retryable(req),
PoolTx::Http2(ref mut tx) => tx.send_request_retryable(req),
}
}
}
impl<B> Poolable for PoolClient<B>