Debian Codegraph @

third_party/rust/document-features/README.md

raw
1 # Document your crate's feature flags
2
3 [![Crates.io](https://img.shields.io/crates/v/document-features)](https://crates.io/crates/document-features)
4 [![Documentation](https://docs.rs/document-features/badge.svg)](https://docs.rs/document-features/)
5
6 This crate provides a macro that extracts documentation comments from Cargo.toml
7
8 To use this crate, add `#![doc = document_features::document_features!()]` in your crate documentation.
9 The `document_features!()` macro reads your `Cargo.toml` file, extracts feature comments and generates
10 a markdown string for your documentation.
11
12 Use `## ` and `#! ` comments in your Cargo.toml to document features, for example:
13
14 ```toml
15 [dependencies]
16 document-features = "0.2"
17 ## ...
18
19 [features]
20 ## The foo feature enables the `foo` functions
21 foo = []
22 ## The bar feature enables the [`bar`] module
23 bar = []
24
25 #! ### Experimental features
26 #! The following features are experimental
27
28 ## Activate the fusion reactor
29 fusion = []
30 ```
31
32 These comments keep the feature definition and documentation next to each other, and they are then
33 rendered into your crate documentation.
34
35 Check out the [documentation](https://docs.rs/document-features/) for more details.
36
37 ## Contributions
38
39 Contributions are welcome. We accept pull requests and bug reports.
40
41 ## License
42
43 MIT OR Apache-2.0