miniconf icon indicating copy to clipboard operation
miniconf copied to clipboard

Expose key docstring metadata

Open ryan-summers opened this issue 2 years ago • 2 comments
trafficstars

As part of the derive macro, it would be useful to use a Key to look up the docstring related to the entry. For example:

#[derive(miniconf::Tree)]
struct Settings {
    /// The selected sampling rate in Hz.
    sample_rate: f32,
}

assert_eq!(Settings::get_metadata("/sample_rate", "The selected sampling rate in Hz."),

This would allow the code comments to be exposed as helpful information about the settings tree

ryan-summers avatar Nov 14 '23 10:11 ryan-summers

roughly like this: https://github.com/cyqsimon/documented/blob/master/documented-derive/src/lib.rs

jordens avatar Nov 14 '23 20:11 jordens

https://git.mkaenner.de/max/macroconf/src/commit/35afc0f4845ad41e902ad0ddbef57c202e11073b/src/lib.rs#L280

jordens avatar Jun 21 '24 11:06 jordens