From f63b1bf4e44d75a841b1ad81b2964f447c4e4ac3 Mon Sep 17 00:00:00 2001 From: Dominik Boehi Date: Thu, 4 Jul 2024 20:01:48 +0200 Subject: [PATCH] Add feature for doc_cfg, specify allowed cfgs in build.rs --- build.rs | 3 +++ src/lib.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/build.rs b/build.rs index 56f7d51..7c7df8e 100644 --- a/build.rs +++ b/build.rs @@ -25,6 +25,9 @@ use std::env; fn main() { let target = env::var("TARGET").unwrap(); + println!("cargo::rustc-check-cfg=cfg(hidapi)"); + println!("cargo::rustc-check-cfg=cfg(libusb)"); + if target.contains("linux") { compile_linux(); } else if target.contains("windows") { diff --git a/src/lib.rs b/src/lib.rs index d81686a..21ce7b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,6 +59,7 @@ //! Since `hidapi` 0.12 it is possible to open MacOS devices with shared access, so that multiple //! [`HidDevice`] handles can access the same physical device. For backward compatibility this is //! an opt-in that can be enabled with the `macos-shared-device` feature flag. +#![cfg_attr(docsrs, feature(doc_cfg))] mod error; mod ffi;