]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Generate docs with features for docs.rs
authorJeffrey Czyz <jkczyz@gmail.com>
Sat, 12 Feb 2022 04:22:20 +0000 (22:22 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 18 Feb 2022 21:38:31 +0000 (15:38 -0600)
Enable generating docs using --all-features or --features="std" where
applicable. Additionally, use doc_auto_cfg to tag items requiring a
feature.

https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg

This requires building with nightly, which is what is used by docs.rs.

https://docs.rs/about/builds

To test locally, use:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc ...

12 files changed:
lightning-background-processor/Cargo.toml
lightning-background-processor/src/lib.rs
lightning-block-sync/Cargo.toml
lightning-block-sync/src/lib.rs
lightning-invoice/Cargo.toml
lightning-invoice/src/lib.rs
lightning-net-tokio/Cargo.toml
lightning-net-tokio/src/lib.rs
lightning-persister/Cargo.toml
lightning-persister/src/lib.rs
lightning/Cargo.toml
lightning/src/lib.rs

index 1837cb17e664839de009f2c01ba2a2ac3055d6dd..0341cd5aedc7dcb0506f5ddce4532e25de682d74 100644 (file)
@@ -9,6 +9,10 @@ Utilities to perform required background tasks for Rust Lightning.
 """
 edition = "2018"
 
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
 [dependencies]
 bitcoin = "0.27"
 lightning = { version = "0.0.104", path = "../lightning", features = ["std"] }
index 8ed0014a72dbc94fda3dd8e2d311120ee23e234f..f2058b108ce4c32c677787173ba107c76d2f3728 100644 (file)
@@ -6,6 +6,8 @@
 #![deny(missing_docs)]
 #![deny(unsafe_code)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 #[macro_use] extern crate lightning;
 
 use lightning::chain;
index 0a395e8b99da0f557f14a0379494faa1d36242b3..3a7d57956afe4e7707f54b28bcb4c784c6d030ac 100644 (file)
@@ -9,6 +9,10 @@ Utilities to fetch the chain data from a block source and feed them into Rust Li
 """
 edition = "2018"
 
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
 [features]
 rest-client = [ "serde", "serde_json", "chunked_transfer" ]
 rpc-client = [ "serde", "serde_json", "chunked_transfer" ]
index ac031132a71946f8706954d49138ff3f7b1e574e..8854aa3e8e4bf8186b6cc119451e62ddc6710fae 100644 (file)
@@ -17,6 +17,8 @@
 #![deny(missing_docs)]
 #![deny(unsafe_code)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 #[cfg(any(feature = "rest-client", feature = "rpc-client"))]
 pub mod http;
 
index e1f33f0fa2662ce9ecb772595dfa537e3d4b9993..3c2678bdc916a06ad8ab9447a6ddf272db567b3f 100644 (file)
@@ -8,6 +8,10 @@ license = "MIT OR Apache-2.0"
 keywords = [ "lightning", "bitcoin", "invoice", "BOLT11" ]
 readme = "README.md"
 
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
 [features]
 default = ["std"]
 no-std = ["hashbrown", "lightning/no-std", "core2/alloc"]
index d676f6c28d6faf7926fa970030ffb1d258fa1af7..841e3f9c69549b4a5a61e4a6e98183261b27e1db 100644 (file)
@@ -5,6 +5,8 @@
 #![deny(unused_mut)]
 #![deny(broken_intra_doc_links)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 #![cfg_attr(feature = "strict", deny(warnings))]
 #![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
 
index 370e3cc4261d0eaa3fc11ccc34a4d25e4d683e01..2b495a117b50b9f9cce50252ebdc00fa47aef69f 100644 (file)
@@ -10,6 +10,10 @@ For Rust-Lightning clients which wish to make direct connections to Lightning P2
 """
 edition = "2018"
 
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
 [dependencies]
 bitcoin = "0.27"
 lightning = { version = "0.0.104", path = "../lightning" }
index 62c036b9796c96f2f812e8eb162835ca9ffd57ba..2582cc597f20d361906271811e8d523f5977516e 100644 (file)
@@ -69,6 +69,8 @@
 #![deny(broken_intra_doc_links)]
 #![deny(missing_docs)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 use bitcoin::secp256k1::key::PublicKey;
 
 use tokio::net::TcpStream;
index 79ffeeeb281ad1e28ef190212c5185b56225f4a3..cb056a60fad39cc74af417bc353827826941527f 100644 (file)
@@ -8,6 +8,10 @@ description = """
 Utilities to manage Rust-Lightning channel data persistence and retrieval.
 """
 
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
 [features]
 _bench_unstable = ["lightning/_bench_unstable"]
 
index 558f4b8fe3cee9d56b75b2230f203ccca6608e9c..a5cbe2f9213e315401be9c0a8bfcc018f7c72a78 100644 (file)
@@ -3,6 +3,8 @@
 #![deny(broken_intra_doc_links)]
 #![deny(missing_docs)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 #![cfg_attr(all(test, feature = "_bench_unstable"), feature(test))]
 #[cfg(all(test, feature = "_bench_unstable"))] extern crate test;
 
index 5f6f2ef655da402c77c132dd1d8061c9658ece9f..058a3b4f7c80d2be557d2004b3d721edd6a230ac 100644 (file)
@@ -10,6 +10,10 @@ Does most of the hard work, without implying a specific runtime, requiring clien
 Still missing tons of error-handling. See GitHub issues for suggested projects if you want to contribute. Don't have to bother telling you not to use this for anything serious, because you'd have to build a client around it to even try.
 """
 
+[package.metadata.docs.rs]
+features = ["std"]
+rustdoc-args = ["--cfg", "docsrs"]
+
 [features]
 # Internal test utilities exposed to other repo crates
 _test_utils = ["hex", "regex", "bitcoin/bitcoinconsensus"]
index 2798f78adf23aa0a52cde63fa86fb30270600b34..6d4cc50a920cad4cde49b91d0329e227c6ad6379 100644 (file)
@@ -28,6 +28,8 @@
 #![allow(bare_trait_objects)]
 #![allow(ellipsis_inclusive_range_patterns)]
 
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+
 #![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
 
 #![cfg_attr(all(any(test, feature = "_test_utils"), feature = "_bench_unstable"), feature(test))]