quartiq / miniconf

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

Support run-time conditional settings #76

Closed ryan-summers closed 2 years ago

ryan-summers commented 2 years ago

For some projects, it's possible that not all settings in the root settings structure should actually be usable (e.g. due to hardware configuration).

An example application of this is Booster, where there are 8 RF channels, but anywhere from 1-8 may be installed.

In these cases, the root settings structure would have an array of 8 settings structs, one for each channel, but the application may detect that certain channels are not present.

Proposal

One approach to this is to make use of the Option type, which is not currently supported in Miniconf.

If the tree is Some(internal), that tree should be republished + "present". If None, the path should be rejected as invalid.