6 releases (breaking)

0.9.1 Nov 4, 2024
0.9.0 Oct 29, 2024
0.8.0 Oct 21, 2024
0.7.1 Oct 16, 2024
0.1.0 Aug 23, 2024

#2121 in Procedural macros

Download history 1697/week @ 2024-09-05 1815/week @ 2024-09-12 1837/week @ 2024-09-19 1943/week @ 2024-09-26 4932/week @ 2024-10-03 7720/week @ 2024-10-10 9317/week @ 2024-10-17 7755/week @ 2024-10-24 7338/week @ 2024-10-31 5139/week @ 2024-11-07 6459/week @ 2024-11-14 7624/week @ 2024-11-21 6939/week @ 2024-11-28 9280/week @ 2024-12-05 6301/week @ 2024-12-12

31,672 downloads per month
Used in 5 crates (via documented)

MIT license

49KB
817 lines

documented

Derive and attribute macros for accessing your type's documentation at runtime

Quick start

use documented::{Documented, DocumentedFields, DocumentedVariants};

/// Trying is the first step to failure.
#[derive(Documented, DocumentedFields, DocumentedVariants)]
enum AlwaysPlay {
    /// And Kb8.
    #[allow(dead_code)]
    Kb1,
    /// But only if you are white.
    F6,
}

// Documented
assert_eq!(AlwaysPlay::DOCS, "Trying is the first step to failure.");

// DocumentedFields
assert_eq!(
    AlwaysPlay::FIELD_DOCS,
    ["And Kb8.", "But only if you are white."]
);
assert_eq!(AlwaysPlay::get_field_docs("Kb1"), Ok("And Kb8."));

// DocumentedVariants
assert_eq!(
    AlwaysPlay::F6.get_variant_docs(),
    "But only if you are white."
);

Dependencies

~0.6–1.2MB
~24K SLoC