#docs #constants #fields #comments #macro

macro no-std doc_consts_derive

get doc comments on fields as runtime constants

4 releases

0.2.1 Nov 19, 2024
0.2.0 Nov 19, 2024
0.1.1 Oct 2, 2024
0.1.0 Aug 2, 2023

#93 in #constants

Download history 10/week @ 2024-09-23 177/week @ 2024-09-30 15/week @ 2024-10-07 10/week @ 2024-10-14 3/week @ 2024-10-28 13/week @ 2024-11-04 283/week @ 2024-11-18 14/week @ 2024-11-25 2/week @ 2024-12-02 10/week @ 2024-12-09

309 downloads per month
Used in 2 crates (via doc_consts)

MIT/Apache

7KB
111 lines

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

~210–640KB
~15K SLoC