Skip to content

Commit 1567dee

Browse files
committed
bus: add doc(cfg).
1 parent 2c71ed6 commit 1567dee

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

embedded-hal-bus/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ std = []
1919
[dependencies]
2020
embedded-hal = { version = "=1.0.0-alpha.11", path = "../embedded-hal" }
2121
critical-section = { version = "1.0" }
22+
23+
[package.metadata.docs.rs]
24+
features = ["std"]
25+
rustdoc-args = ["--cfg", "docsrs"]

embedded-hal-bus/src/i2c/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::sync::Mutex;
66
/// Sharing is implemented with an `std` [`Mutex`](std::sync::Mutex). It allows a single bus across multiple threads,
77
/// with finer-grained locking than [`CriticalSectionDevice`](super::CriticalSectionDevice). The downside is that
88
/// it is only available in `std` targets.
9+
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
910
pub struct MutexDevice<'a, T> {
1011
bus: &'a Mutex<T>,
1112
}

embedded-hal-bus/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![doc = include_str!("../README.md")]
22
#![warn(missing_docs)]
33
#![cfg_attr(not(feature = "std"), no_std)]
4+
#![cfg_attr(docsrs, feature(doc_cfg))]
45

56
pub mod i2c;
67
pub mod spi;

embedded-hal-bus/src/spi/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use super::DeviceError;
1313
/// Sharing is implemented with a `std` [`Mutex`](std::sync::Mutex). It allows a single bus across multiple threads,
1414
/// with finer-grained locking than [`CriticalSectionDevice`](super::CriticalSectionDevice). The downside is
1515
/// it is only available in `std` targets.
16+
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
1617
pub struct MutexDevice<'a, BUS, CS, D> {
1718
bus: &'a Mutex<BUS>,
1819
cs: CS,

0 commit comments

Comments
 (0)