Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: enable feature tagging #2395

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,18 @@ jobs:
with:
submodules: true

- name: Install rust toolchain
id: toolchain
# nightly docrs features are used
- name: Install rust nightly toolchain
id: nightly-toolchain
run: |
rustup toolchain install stable --profile minimal
rustup override set stable

rustup toolchain install nightly --profile minimal

- uses: camshaft/rust-cache@v1

- name: Run cargo doc
run: cargo doc --all-features --no-deps --workspace --exclude s2n-quic-qns
run: cargo +nightly doc --all-features --no-deps --workspace --exclude s2n-quic-qns
env:
RUSTDOCFLAGS: --cfg docsrs

- uses: aws-actions/[email protected]
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
Expand Down
10 changes: 10 additions & 0 deletions quic/s2n-quic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@
//! [s2n-tls]: https://github.com/aws/s2n-tls
//! [rustls]: https://github.com/rustls/rustls

// Tag docs with the required platform and features.
// https://doc.rust-lang.org/rustdoc/unstable-features.html
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(
docsrs,
feature(doc_auto_cfg),
feature(doc_cfg_hide),
doc(cfg_hide(doc))
)]

#[macro_use]
pub mod provider;

Expand Down
5 changes: 5 additions & 0 deletions quic/s2n-quic/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub(crate) mod sync;

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-connection-close-formatter"))] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-connection-close-formatter")))]
pub mod connection_close_formatter;
} else {
#[allow(dead_code)]
Expand All @@ -35,6 +36,7 @@ cfg_if!(

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-packet-interceptor"))] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-packet-interceptor")))]
pub mod packet_interceptor;
} else {
#[allow(dead_code)]
Expand All @@ -44,6 +46,7 @@ cfg_if!(

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-random"))] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-random")))]
pub mod random;
} else {
#[allow(dead_code)]
Expand All @@ -53,6 +56,7 @@ cfg_if!(

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-datagram"))] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-datagram")))]
pub mod datagram;
} else {
#[allow(dead_code)]
Expand All @@ -62,6 +66,7 @@ cfg_if!(

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-dc"))] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-dc")))]
pub mod dc;
} else {
#[allow(dead_code)]
Expand Down
1 change: 1 addition & 0 deletions quic/s2n-quic/src/provider/congestion_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub trait Provider {

cfg_if! {
if #[cfg(feature = "unstable-congestion-controller")] {
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-congestion-controller")))]
// Export the types needed to implement the CongestionController trait
pub use s2n_quic_core::{
random::Generator as RandomGenerator,
Expand Down
3 changes: 3 additions & 0 deletions quic/s2n-quic/src/provider/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl_provider_utils!();

cfg_if! {
if #[cfg(feature = "provider-tls-default")] {
#[cfg_attr(docsrs, doc(cfg(feature = "provider-tls-default")))]
pub mod default {
//! Provides the recommended implementation of TLS using platform detection
pub use super::default_tls::*;
Expand Down Expand Up @@ -238,6 +239,7 @@ mod default_tls {
// TODO stub out default that fails with error when started
}

#[cfg_attr(docsrs, doc(cfg(feature = "provider-tls-rustls")))]
#[cfg(feature = "s2n-quic-rustls")]
pub mod rustls {
//! Provides the [rustls](https://docs.rs/rustls/) implementation of TLS
Expand Down Expand Up @@ -273,6 +275,7 @@ pub mod rustls {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "provider-tls-s2n")))]
#[cfg(feature = "s2n-quic-tls")]
pub mod s2n_tls {
//! Provides the [s2n-tls](https://github.com/aws/s2n-tls) implementation of TLS
Expand Down
Loading