#[derive(DocumentedVariants)]
Expand description
Derive proc-macro for DocumentedVariants
trait.
§Example
use documented::{DocumentedVariants, Error};
#[derive(DocumentedVariants)]
enum NeverPlay {
/// Terrible.
F3,
/// I fell out of my chair.
F6,
}
assert_eq!(NeverPlay::F3.get_variant_docs(), "Terrible.");
assert_eq!(NeverPlay::F6.get_variant_docs(), "I fell out of my chair.");
§Configuration
With the customise
feature enabled, you can customise this macro’s
behaviour using the #[documented_variants(...)]
attribute. Note that this
attribute works on both the container and each individual variant, with the
per-variant configurations overriding container configurations, which
override the default.
Currently, you can (selectively) disable line-trimming like so:
#[derive(DocumentedVariants)]
#[documented_variants(trim = false)]
enum Always {
/// Or the quality.
SacTheExchange,
/// Like a Frenchman.
#[documented_variants(trim = true)]
Retreat,
}
assert_eq!(
Always::SacTheExchange.get_variant_docs(),
" Or the quality."
);
assert_eq!(Always::Retreat.get_variant_docs(), "Like a Frenchman.");
If there are other configuration options you wish to have, please submit an issue or a PR.