Skip to content

Commit 6f85b37

Browse files
committed
Document async-tokio feature
`AsyncLineEventHandle` and `async_events` show with a warning `This is supported on feature="async-tokio" only.`
1 parent a8c1c10 commit 6f85b37

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)