diff --git a/Cargo.toml b/Cargo.toml index 565eead9..2c1f8892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,3 +61,8 @@ name = "proto" path = "benches/encoding/proto.rs" harness = false required-features = ["protobuf"] + +# Passing arguments to the docsrs builder in order to properly document cfg's. +# More information: https://docs.rs/about/builds#cross-compiling +[package.metadata.docs.rs] +all-features = true diff --git a/src/encoding.rs b/src/encoding.rs index 23c60328..30993999 100644 --- a/src/encoding.rs +++ b/src/encoding.rs @@ -13,6 +13,7 @@ use std::rc::Rc; use std::sync::Arc; #[cfg(feature = "protobuf")] +#[cfg_attr(docsrs, doc(cfg(feature = "protobuf")))] pub mod protobuf; pub mod text; diff --git a/src/lib.rs b/src/lib.rs index cf39dc1a..cfff6238 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ #![deny(unused)] #![forbid(unsafe_code)] #![warn(missing_debug_implementations)] +#![cfg_attr(docsrs, feature(doc_cfg))] //! Client library implementation of the [Open Metrics //! specification](https://github.com/OpenObservability/OpenMetrics). Allows