Require the native-tls feature to supply a preconfigured tls (#814)

This commit is contained in:
Sean McArthur
2020-02-21 12:41:13 -08:00
committed by GitHub
parent 9ab8ab945c
commit 2e06108f70
5 changed files with 55 additions and 27 deletions

View File

@@ -1,3 +1,7 @@
#[cfg(any(
feature = "native-tls",
feature = "rustls-tls",
))]
use std::any::Any;
use std::convert::TryInto;
use std::fmt;
@@ -455,7 +459,15 @@ impl ClientBuilder {
///
/// If the passed `Any` argument is not a TLS backend that reqwest
/// understands, the `ClientBuilder` will error when calling `build`.
#[cfg(feature = "__tls")]
///
/// # Optional
///
/// This requires one of the optional features `native-tls` or
/// `rustls-tls` to be enabled.
#[cfg(any(
feature = "native-tls",
feature = "rustls-tls",
))]
pub fn use_preconfigured_tls(self, tls: impl Any) -> ClientBuilder {
self.with_inner(move |inner| inner.use_preconfigured_tls(tls))
}