Skip to content

Commit 2ad0d6d

Browse files
committed
docs: add "unstable-config" feature
Some of the spots don't actually highlight the feature correctly in the docs, notably the functions on the trait.
1 parent 32001a2 commit 2ad0d6d

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rustdoc-args = ["--cfg", "feature=\"docs\""]
2121

2222
[features]
2323
default = ["h1_client", "native-tls"]
24-
docs = ["h1_client", "curl_client", "wasm_client", "hyper_client"]
24+
docs = ["h1_client", "curl_client", "wasm_client", "hyper_client", "unstable-config"]
2525

2626
h1_client = ["async-h1", "async-std", "deadpool", "futures"]
2727
native_client = ["curl_client", "wasm_client"]

src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::fmt::Debug;
44
use std::time::Duration;
55

66
/// Configuration for `HttpClient`s.
7+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
78
#[non_exhaustive]
89
#[derive(Clone)]
910
pub struct Config {
@@ -20,9 +21,11 @@ pub struct Config {
2021
/// Default: `Some(Duration::from_secs(60))`.
2122
pub timeout: Option<Duration>,
2223
/// TLS Configuration (Rustls)
24+
#[cfg_attr(feature = "docs", doc(cfg(feature = "h1_client")))]
2325
#[cfg(all(feature = "h1_client", feature = "rustls"))]
2426
pub tls_config: Option<std::sync::Arc<rustls_crate::ClientConfig>>,
2527
/// TLS Configuration (Native TLS)
28+
#[cfg_attr(feature = "docs", doc(cfg(feature = "h1_client")))]
2629
#[cfg(all(feature = "h1_client", feature = "native-tls", not(feature = "rustls")))]
2730
pub tls_config: Option<std::sync::Arc<async_native_tls::TlsConnector>>,
2831
}
@@ -91,6 +94,7 @@ impl Config {
9194
}
9295

9396
/// Set TLS Configuration (Rustls)
97+
#[cfg_attr(feature = "docs", doc(cfg(feature = "h1_client")))]
9498
#[cfg(all(feature = "h1_client", feature = "rustls"))]
9599
pub fn set_tls_config(
96100
mut self,
@@ -100,6 +104,7 @@ impl Config {
100104
self
101105
}
102106
/// Set TLS Configuration (Native TLS)
107+
#[cfg_attr(feature = "docs", doc(cfg(feature = "h1_client")))]
103108
#[cfg(all(feature = "h1_client", feature = "native-tls", not(feature = "rustls")))]
104109
pub fn set_tls_config(
105110
mut self,

src/h1/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! http-client implementation for async-h1, with connecton pooling ("Keep-Alive").
1+
//! http-client implementation for async-h1, with connection pooling ("Keep-Alive").
22
33
#[cfg(feature = "unstable-config")]
44
use std::convert::{Infallible, TryFrom};
@@ -272,6 +272,7 @@ impl HttpClient for H1Client {
272272
))
273273
}
274274

275+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
275276
#[cfg(feature = "unstable-config")]
276277
/// Override the existing configuration with new configuration.
277278
///
@@ -282,13 +283,15 @@ impl HttpClient for H1Client {
282283
Ok(())
283284
}
284285

286+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
285287
#[cfg(feature = "unstable-config")]
286288
/// Get the current configuration.
287289
fn config(&self) -> &Config {
288290
&*self.config
289291
}
290292
}
291293

294+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
292295
#[cfg(feature = "unstable-config")]
293296
impl TryFrom<Config> for H1Client {
294297
type Error = Infallible;

src/hyper.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ impl HttpClient for HyperClient {
9292
Ok(res)
9393
}
9494

95+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
9596
#[cfg(feature = "unstable-config")]
9697
/// Override the existing configuration with new configuration.
9798
///
@@ -110,13 +111,15 @@ impl HttpClient for HyperClient {
110111
Ok(())
111112
}
112113

114+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
113115
#[cfg(feature = "unstable-config")]
114116
/// Get the current configuration.
115117
fn config(&self) -> &Config {
116118
&self.config
117119
}
118120
}
119121

122+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
120123
#[cfg(feature = "unstable-config")]
121124
impl TryFrom<Config> for HyperClient {
122125
type Error = Infallible;

src/isahc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl HttpClient for IsahcClient {
7575
Ok(response)
7676
}
7777

78+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
7879
#[cfg(feature = "unstable-config")]
7980
/// Override the existing configuration with new configuration.
8081
///
@@ -98,13 +99,15 @@ impl HttpClient for IsahcClient {
9899
Ok(())
99100
}
100101

102+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
101103
#[cfg(feature = "unstable-config")]
102104
/// Get the current configuration.
103105
fn config(&self) -> &Config {
104106
&self.config
105107
}
106108
}
107109

110+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
108111
#[cfg(feature = "unstable-config")]
109112
impl TryFrom<Config> for IsahcClient {
110113
type Error = isahc::Error;

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ pub use config::Config;
2121
#[cfg(not(feature = "unstable-config"))]
2222
type Config = ();
2323

24-
#[cfg_attr(feature = "docs", doc(cfg(curl_client)))]
24+
#[cfg_attr(feature = "docs", doc(cfg(feature = "curl_client")))]
2525
#[cfg(all(feature = "curl_client", not(target_arch = "wasm32")))]
2626
pub mod isahc;
2727

28-
#[cfg_attr(feature = "docs", doc(cfg(wasm_client)))]
28+
#[cfg_attr(feature = "docs", doc(cfg(feature = "wasm_client")))]
2929
#[cfg(all(feature = "wasm_client", target_arch = "wasm32"))]
3030
pub mod wasm;
3131

32-
#[cfg_attr(feature = "docs", doc(cfg(native_client)))]
32+
#[cfg_attr(feature = "docs", doc(cfg(feature = "native_client")))]
3333
#[cfg(any(feature = "curl_client", feature = "wasm_client"))]
3434
pub mod native;
3535

36-
#[cfg_attr(feature = "docs", doc(cfg(h1_client)))]
37-
#[cfg_attr(feature = "docs", doc(cfg(default)))]
36+
#[cfg_attr(feature = "docs", doc(cfg(feature = "h1_client")))]
37+
#[cfg_attr(feature = "docs", doc(cfg(feature = "default")))]
3838
#[cfg(any(feature = "h1_client", feature = "h1_client_rustls"))]
3939
pub mod h1;
4040

41-
#[cfg_attr(feature = "docs", doc(cfg(hyper_client)))]
41+
#[cfg_attr(feature = "docs", doc(cfg(feature = "hyper_client")))]
4242
#[cfg(feature = "hyper_client")]
4343
pub mod hyper;
4444

@@ -106,11 +106,13 @@ impl HttpClient for Box<dyn HttpClient> {
106106
self.as_ref().send(req).await
107107
}
108108

109+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
109110
#[cfg(feature = "unstable-config")]
110111
fn set_config(&mut self, config: Config) -> http_types::Result<()> {
111112
self.as_mut().set_config(config)
112113
}
113114

115+
#[cfg_attr(feature = "docs", doc(cfg(feature = "unstable-config")))]
114116
#[cfg(feature = "unstable-config")]
115117
fn config(&self) -> &Config {
116118
self.as_ref().config()

0 commit comments

Comments
 (0)