From 63efc3ffd5e55e85b7677a0fe7aea46524134724 Mon Sep 17 00:00:00 2001 From: ItsEthra <107059409+ItsEthra@users.noreply.github.com> Date: Thu, 30 Nov 2023 18:10:49 +0300 Subject: [PATCH] Generate docs with cfg badges --- Cargo.toml | 4 ++++ src/guard.rs | 1 + src/lib.rs | 4 ++++ src/responders.rs | 1 + 4 files changed, 10 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index c898f59..17d30d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ edition = "2021" [features] default = [] +unstable = [] guards = ["tower", "futures-core", "pin-project-lite"] serde = ["dep:serde", "dep:serde_json"] @@ -26,3 +27,6 @@ pin-project-lite = { version = "0.2", optional = true } # Optional dependencies required for the `serde` feature. serde = { version = "1", features = ["derive"], optional = true } serde_json = { version = "1", optional = true } + +[package.metadata.docs.rs] +all-features = true diff --git a/src/guard.rs b/src/guard.rs index 66b440b..38d078c 100644 --- a/src/guard.rs +++ b/src/guard.rs @@ -51,6 +51,7 @@ impl<'a, S> Layer for HxRequestGuardLayer<'a> { } } +/// Tower service that implementes redirecting to non-partial routes. #[derive(Debug, Clone)] pub struct HxRequestGuard<'a, S> { inner: S, diff --git a/src/lib.rs b/src/lib.rs index c052717..cd77122 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,17 @@ +#![cfg_attr(feature = "unstable", feature(doc_cfg))] #![doc = include_str!("../README.md")] #![forbid(unsafe_code)] + pub mod extractors; #[cfg(feature = "guards")] +#[cfg_attr(feature = "unstable", doc(cfg(feature = "guards")))] pub mod guard; pub mod headers; pub mod responders; pub use extractors::*; #[cfg(feature = "guards")] +#[cfg_attr(feature = "unstable", doc(cfg(feature = "guards")))] pub use guard::*; pub use headers::*; pub use responders::*; diff --git a/src/responders.rs b/src/responders.rs index 778818e..e92a3c9 100644 --- a/src/responders.rs +++ b/src/responders.rs @@ -10,6 +10,7 @@ use axum::{ use crate::headers; #[cfg(feature = "serde")] +#[cfg_attr(feature = "unstable", doc(cfg(feature = "serde")))] pub mod serde; const HX_SWAP_INNER_HTML: &str = "innerHTML";