#docs #constants #fields #comments #macro

no-std doc_consts

get doc comments on fields as runtime constants

6 releases

new 0.3.1 Nov 19, 2024
0.3.0 Nov 19, 2024
0.2.2 Oct 2, 2024
0.2.0 Aug 2, 2023
0.1.0 Aug 2, 2023

#209 in Procedural macros

26 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);
}

no_std support

Set the no_std feature to remove map access and make the crate no_std compatible

Dependencies

~240–690KB
~16K SLoC