commit 9724bf4de5b6b9baa2c0cdce7339f4a53cea4986
parent dcf30a700203b319895720fd368488329a5c340c
Author: Eric Scouten <scouten@adobe.com>
Date: Thu, 14 Jul 2022 08:18:45 -0700
Configure docs.rs to include feature-gated items (#73)
Also (using a nightly feature) it will automatically add annotations about the crate feature that is required to gain access to such items.
Diffstat:
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
@@ -153,20 +153,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- - name: Install Rust toolchain
+ - name: Install nightly Rust toolchain
+ # Nightly is used here because the docs.rs build
+ # uses nightly and we use doc_cfg features that are
+ # not in stable Rust as of this writing (Rust 1.62).
uses: actions-rs/toolchain@v1
with:
- toolchain: stable
+ toolchain: nightly
override: true
- - name: Cache Rust dependencies
- uses: Swatinem/rust-cache@v1
-
- name: Run cargo docs
- uses: actions-rs/cargo@v1
- with:
- command: doc
- args: --no-deps
+ run: cargo +nightly doc --all-features
+ env:
+ RUSTDOCFLAGS: --cfg docsrs
cargo-deny:
name: License / vulnerability audit
diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml
@@ -12,6 +12,10 @@ edition = "2018"
rust-version = "1.58.0"
exclude = ["tests/fixtures"]
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
[features]
async_signer = ["async-trait"]
bmff = [] # Work in progress support for BMFF-based containers
diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs
@@ -15,6 +15,7 @@
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]
#![deny(clippy::unwrap_used)]
+#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg, doc_cfg_hide))]
//! This library supports reading, creating and embedding C2PA data
//! with JPEG and PNG images.