9个版本 (4个重大更新)

0.5.0 2024年6月1日
0.4.3 2024年5月27日
0.4.1 2024年4月7日
0.3.0 2024年1月25日
0.1.2 2023年6月7日

#11 in #documented

Download history 141/week @ 2024-05-02 157/week @ 2024-05-09 243/week @ 2024-05-16 495/week @ 2024-05-23 664/week @ 2024-05-30 377/week @ 2024-06-06 262/week @ 2024-06-13 336/week @ 2024-06-20 204/week @ 2024-06-27 215/week @ 2024-07-04 147/week @ 2024-07-11 242/week @ 2024-07-18 298/week @ 2024-07-25 345/week @ 2024-08-01 716/week @ 2024-08-08 796/week @ 2024-08-15

每月 2,211 次下载
5个crate中使用(通过documented

MIT许可协议

21KB
348

documented

traits 和派生宏,用于在运行时访问您的类型文档

快速开始

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.")
);

依赖项

~260–710KB
~17K SLoC