Use doc_cfg to show feature requirements (#1134)
* Use `doc_cfg` to show feature requirements * Apply suggestions from code review
This commit is contained in:
@@ -194,6 +194,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `cookies` feature to be enabled.
|
||||
#[cfg(feature = "cookies")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "cookies")))]
|
||||
pub fn cookie_store(self, enable: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.cookie_store(enable))
|
||||
}
|
||||
@@ -215,6 +216,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `gzip` feature to be enabled
|
||||
#[cfg(feature = "gzip")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "gzip")))]
|
||||
pub fn gzip(self, enable: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.gzip(enable))
|
||||
}
|
||||
@@ -236,6 +238,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `brotli` feature to be enabled
|
||||
#[cfg(feature = "brotli")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "brotli")))]
|
||||
pub fn brotli(self, enable: bool) -> ClientBuilder { self.with_inner(|inner| inner.brotli(enable)) }
|
||||
|
||||
/// Disable auto response body gzip decompression.
|
||||
@@ -442,6 +445,7 @@ impl ClientBuilder {
|
||||
/// This requires the optional `default-tls`, `native-tls`, or `rustls-tls(-...)`
|
||||
/// feature to be enabled.
|
||||
#[cfg(feature = "__tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "default-tls", feature = "native-tls", feature = "rustls-tls"))))]
|
||||
pub fn add_root_certificate(self, cert: Certificate) -> ClientBuilder {
|
||||
self.with_inner(move |inner| inner.add_root_certificate(cert))
|
||||
}
|
||||
@@ -455,6 +459,7 @@ impl ClientBuilder {
|
||||
/// This requires the optional `default-tls`, `native-tls`, or `rustls-tls(-...)`
|
||||
/// feature to be enabled.
|
||||
#[cfg(feature = "__tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "default-tls", feature = "native-tls", feature = "rustls-tls"))))]
|
||||
pub fn tls_built_in_root_certs(
|
||||
self,
|
||||
tls_built_in_root_certs: bool,
|
||||
@@ -469,6 +474,7 @@ impl ClientBuilder {
|
||||
/// This requires the optional `native-tls` or `rustls-tls(-...)` feature to be
|
||||
/// enabled.
|
||||
#[cfg(any(feature = "native-tls", feature = "__rustls"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "native-tls", feature = "rustls-tls"))))]
|
||||
pub fn identity(self, identity: Identity) -> ClientBuilder {
|
||||
self.with_inner(move |inner| inner.identity(identity))
|
||||
}
|
||||
@@ -488,6 +494,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `native-tls` feature to be enabled.
|
||||
#[cfg(feature = "native-tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "native-tls")))]
|
||||
pub fn danger_accept_invalid_hostnames(self, accept_invalid_hostname: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.danger_accept_invalid_hostnames(accept_invalid_hostname))
|
||||
}
|
||||
@@ -504,6 +511,7 @@ impl ClientBuilder {
|
||||
/// introduces significant vulnerabilities, and should only be used
|
||||
/// as a last resort.
|
||||
#[cfg(feature = "__tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "default-tls", feature = "native-tls", feature = "rustls-tls"))))]
|
||||
pub fn danger_accept_invalid_certs(self, accept_invalid_certs: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.danger_accept_invalid_certs(accept_invalid_certs))
|
||||
}
|
||||
@@ -517,6 +525,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `native-tls` feature to be enabled.
|
||||
#[cfg(feature = "native-tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "native-tls")))]
|
||||
pub fn use_native_tls(self) -> ClientBuilder {
|
||||
self.with_inner(move |inner| inner.use_native_tls())
|
||||
}
|
||||
@@ -530,6 +539,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `rustls-tls(-...)` feature to be enabled.
|
||||
#[cfg(feature = "__rustls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
|
||||
pub fn use_rustls_tls(self) -> ClientBuilder {
|
||||
self.with_inner(move |inner| inner.use_rustls_tls())
|
||||
}
|
||||
@@ -556,6 +566,7 @@ impl ClientBuilder {
|
||||
feature = "native-tls",
|
||||
feature = "__rustls",
|
||||
))]
|
||||
#[cfg_attr(docsrs, doc(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))
|
||||
}
|
||||
@@ -568,6 +579,7 @@ impl ClientBuilder {
|
||||
///
|
||||
/// This requires the optional `trust-dns` feature to be enabled
|
||||
#[cfg(feature = "trust-dns")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "trust-dns")))]
|
||||
pub fn trust_dns(self, enable: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.trust_dns(enable))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user