From 0f85e8eb84a9faa3c60585f64eb452c4228d0f55 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 15 Jul 2024 16:35:40 +0200 Subject: [PATCH] docs: enable for protobuf feature (#208) - have docs.rs generate with `protobuf` feature - flag that only enabled with `protobuf` feature Signed-off-by: Max Inden --- Cargo.toml | 5 +++++ src/encoding.rs | 1 + src/lib.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index fae43aa5..4f78e1ef 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