code-docs-rs 0.2.0

Use code docs as runtime documentation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod documented_struct;
mod documented_enum;
mod documented_consts;

pub use documented_struct::DocumentedStruct;
pub use documented_enum::DocumentedEnum;
pub use documented_consts::DocumentedConstants;

pub(crate) fn filter_docs(meta: &str) -> Option<&str> {
    // i do not want to use regex crate
    meta.strip_prefix("doc = r\"")
        .or(meta.strip_prefix("doc =\nr\"")) // there was a newline before comment
        .and_then(|x| x.strip_suffix("\"")) // remove the quotes
}