9 releases (4 breaking)

0.5.0 Jun 1, 2024
0.4.3 May 27, 2024
0.4.1 Apr 7, 2024
0.3.0 Jan 25, 2024
0.1.2 Jun 7, 2023

#8 in #documented

Download history 1583/week @ 2024-10-14 1137/week @ 2024-10-21 1178/week @ 2024-10-28 1107/week @ 2024-11-04 1123/week @ 2024-11-11 985/week @ 2024-11-18 320/week @ 2024-11-25 133/week @ 2024-12-02 158/week @ 2024-12-09 125/week @ 2024-12-16 2/week @ 2024-12-23 11/week @ 2024-12-30 80/week @ 2025-01-06 103/week @ 2025-01-13 155/week @ 2025-01-20 280/week @ 2025-01-27

619 downloads per month

MIT license

21KB
348 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

~220–660KB
~16K SLoC