Skip to content

Commit

Permalink
Document feature flags better
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Feb 12, 2022
1 parent 418791f commit b840cfd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion serial_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ lazy_static = "1.2"
parking_lot = ">= 0.10, < 0.12"
serial_test_derive = { version = "~0.5.1", path = "../serial_test_derive" }
fslock = {version = "0.2", optional = true}
document-features = "0.2"

[features]
default = []

## The file_locks feature unlocks the `file_serial` macro
file_locks = ["fslock"]

# docs.rs-specific configuration
[package.metadata.docs.rs]
all-features = true
all-features = true
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]
3 changes: 3 additions & 0 deletions serial_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
//! // Do things
//! }
//! ````
//!
//! ## Feature flags
#![doc = document_features::document_features!()]

mod code_lock;
#[cfg(feature = "file_locks")]
Expand Down
3 changes: 3 additions & 0 deletions serial_test_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! # serial_test_derive
//! Helper crate for [serial_test](../serial_test/index.html)

#![cfg_attr(docsrs, feature(doc_cfg))]

extern crate proc_macro;

use proc_macro::TokenStream;
Expand Down Expand Up @@ -99,6 +101,7 @@ pub fn serial(attr: TokenStream, input: TokenStream) -> TokenStream {
/// Note that in this case you need to specify the `name` arg as well (as per [serial](macro@serial)). The path defaults to a reasonable temp directory for the OS if not specified.
#[proc_macro_attribute]
#[proc_macro_error]
#[cfg_attr(docsrs, doc(cfg(feature = "file_locks")))]
pub fn file_serial(attr: TokenStream, input: TokenStream) -> TokenStream {
fs_serial_core(attr.into(), input.into()).into()
}
Expand Down

0 comments on commit b840cfd

Please sign in to comment.