Skip to content

Commit 730b94e

Browse files
committed
Show feature gated bindings in documentaion (cloudevents#187)
* show feature gated bindings in docsrs * moved crate root docsrs feature * fixed cargo fmt check * removed files that should go with another PR Signed-off-by: minghuaw <[email protected]>
1 parent 2ab34e4 commit 730b94e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ exclude = [
1313
]
1414
categories = ["web-programming", "encoding", "data-structures"]
1515

16+
# Enable all features when building on docs.rs to show feature gated bindings
17+
[package.metadata.docs.rs]
18+
all-features = true
19+
rustdoc-args = ["--cfg", "docsrs"]
20+
1621
[lib]
1722
name = "cloudevents"
1823

src/binding/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
//! Provides protocol binding implementations for [`crate::Event`].
22
3+
#[cfg_attr(docsrs, doc(cfg(feature = "actix")))]
34
#[cfg(feature = "actix")]
45
pub mod actix;
6+
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
57
#[cfg(feature = "axum")]
68
pub mod axum;
79
#[cfg(feature = "fe2o3-amqp")]
810
pub mod fe2o3_amqp;
11+
12+
#[cfg_attr(
13+
docsrs,
14+
doc(cfg(any(
15+
feature = "http-binding",
16+
feature = "actix",
17+
feature = "warp",
18+
feature = "reqwest",
19+
feature = "axum",
20+
feature = "poem"
21+
)))
22+
)]
923
#[cfg(any(
1024
feature = "http-binding",
1125
feature = "actix",
@@ -15,14 +29,19 @@ pub mod fe2o3_amqp;
1529
feature = "poem"
1630
))]
1731
pub mod http;
32+
#[cfg_attr(docsrs, doc(cfg(feature = "nats")))]
1833
#[cfg(feature = "nats")]
1934
pub mod nats;
35+
#[cfg_attr(docsrs, doc(cfg(feature = "poem")))]
2036
#[cfg(feature = "poem")]
2137
pub mod poem;
38+
#[cfg_attr(docsrs, doc(cfg(feature = "rdkafka")))]
2239
#[cfg(feature = "rdkafka")]
2340
pub mod rdkafka;
41+
#[cfg_attr(docsrs, doc(cfg(feature = "reqwest")))]
2442
#[cfg(feature = "reqwest")]
2543
pub mod reqwest;
44+
#[cfg_attr(docsrs, doc(cfg(feature = "warp")))]
2645
#[cfg(feature = "warp")]
2746
pub mod warp;
2847

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
5757
#![doc(html_root_url = "https://docs.rs/cloudevents-sdk/0.5.0")]
5858
#![deny(rustdoc::broken_intra_doc_links)]
59+
#![cfg_attr(docsrs, feature(doc_cfg))] // Show feature gate in doc
5960

6061
pub mod binding;
6162
pub mod event;

0 commit comments

Comments
 (0)