quartiq / miniconf

Rust serialize/deserialize/access reflection for trees (no_std, no alloc)
MIT License
25 stars 3 forks source link

Expose key docstring metadata #187

Open ryan-summers opened 10 months ago

ryan-summers commented 10 months ago

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

jordens commented 10 months ago

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

jordens commented 3 months ago

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