Skip to content

Commit 246f5ba

Browse files
Merge #45
45: Document `async-tokio` feature on docs.rs r=ryankurte a=dfrankland Documents things behind features on docs.rs <img width="483" alt="Screen Shot 2021-01-11 at 5 51 44 PM" src="https://user-images.githubusercontent.com/2488926/104259235-e06a6100-5435-11eb-9632-bb04e7fea292.png"> <img width="782" alt="Screen Shot 2021-01-11 at 5 51 18 PM" src="https://user-images.githubusercontent.com/2488926/104259239-e2342480-5435-11eb-8057-8b81ab3afa91.png"> Co-authored-by: Dylan Frankland <[email protected]>
2 parents eca8107 + 6f85b37 commit 246f5ba

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ mio = { version = "0.6", optional = true }
3030
[dev-dependencies]
3131
quicli = "0.2"
3232
anyhow = "1.0"
33+
34+
[package.metadata.docs.rs]
35+
# To build locally:
36+
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps --open
37+
all-features = true
38+
rustdoc-args = ["--cfg", "docsrs"]

src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
//!
8383
//! [README on Github]: https://github.com/rust-embedded/rust-gpio-cdev
8484
85+
#![cfg_attr(docsrs, feature(doc_cfg))]
86+
8587
#[macro_use]
8688
extern crate bitflags;
8789
#[macro_use]
@@ -99,6 +101,7 @@ use std::slice;
99101
use std::sync::Arc;
100102

101103
#[cfg(feature = "async-tokio")]
104+
#[cfg_attr(docsrs, doc(cfg(feature = "async-tokio")))]
102105
mod async_tokio;
103106
pub mod errors; // pub portion is deprecated
104107
mod ffi;
@@ -114,6 +117,7 @@ pub enum IoctlKind {
114117
}
115118

116119
#[cfg(feature = "async-tokio")]
120+
#[cfg_attr(docsrs, doc(cfg(feature = "async-tokio")))]
117121
pub use crate::async_tokio::AsyncLineEventHandle;
118122
pub use errors::*;
119123

@@ -562,6 +566,7 @@ impl Line {
562566
}
563567

564568
#[cfg(feature = "async-tokio")]
569+
#[cfg_attr(docsrs, doc(cfg(feature = "async-tokio")))]
565570
pub fn async_events(
566571
&self,
567572
handle_flags: LineRequestFlags,

0 commit comments

Comments
 (0)