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 318/week @ 2024-07-24 325/week @ 2024-07-31 643/week @ 2024-08-07 760/week @ 2024-08-14 821/week @ 2024-08-21 1416/week @ 2024-08-28 1667/week @ 2024-09-04 1223/week @ 2024-09-11 1376/week @ 2024-09-18 1224/week @ 2024-09-25 1279/week @ 2024-10-02 1752/week @ 2024-10-09 1449/week @ 2024-10-16 1160/week @ 2024-10-23 1177/week @ 2024-10-30 1032/week @ 2024-11-06

5,077 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 {
    #[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,
    [None, Some("But only if you are white.")]
);
assert_eq!(
    AlwaysPlay::get_field_docs("F6"),
    Ok("But only if you are white.")
);

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

Dependencies

~235–680KB
~16K SLoC