#docs #constants #fields #comments #macro

doc_consts

get doc comments on fields as runtime constants

2 unstable releases

0.2.0 Aug 2, 2023
0.1.0 Aug 2, 2023

#587 in Procedural macros

46 downloads per month
Used in wspick

MIT/Apache

7KB

doc_consts

get doc comments on fields as runtime constants

#[derive(DocConsts)]
struct Test {
    /// doc comment
    ///     with indentation
    field: (),
    /// another doc comment
    field2: (),
}

#[test]
fn it_works() {
    assert_eq!("doc comment\n    with indentation", Test::get_docs().field);
    assert_eq!("another doc comment", Test::get_docs().field2);
}

Dependencies

~300–730KB
~18K SLoC