#[derive(ConfigDoc)]
{
// Attributes available to this derive:
#[config_doc]
}
Expand description
This proc macro recursively extracts rustdoc comments from the fields in a struct and generates a method that produces docs for each field.
Unlike rustdoc, this tool focuses solely on extracting rustdoc for struct fields, without methods.
Example:
ⓘ
#[derive(ConfigDoc)]
pub struct Foo {
/// Description for `a`.
a: i32,
#[config_doc(nested)]
b: Bar,
#[config_doc(omitted)]
dummy: (),
}
The #[config_doc(nested)]
attribute indicates that the field is a nested config that will be documented in a separate section.
Fields marked with #[config_doc(omitted)]
will simply be omitted from the doc.
Here is the method generated by this macro:
ⓘ
impl Foo {
pub fn config_docs(name: String, docs: &mut std::collections::BTreeMap<String, Vec<(String, String)>>)
}
In test_example_up_to_date
, we further process the output of this method to generate a markdown in src/config/docs.md.