documented

Crates.iodocumented
lib.rsdocumented
version0.5.0
sourcesrc
created_at2023-06-05 16:40:17.02234
updated_at2024-06-01 23:14:47.833255
descriptionTraits and derive macros for accessing your type's documentation at runtime
homepage
repositoryhttps://github.com/cyqsimon/documented
max_upload_size
id883170
size5,891
(cyqsimon)

documentation

README

documented

Traits and derive macros for accessing your type's documentation at runtime

Quick start

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

/// Trying is the first step to failure.
#[derive(Documented, DocumentedFields, DocumentedVariants)]
enum AlwaysPlay {
    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.")
);
Commit count: 57

cargo fmt