Automatic generation of sample configs with documentation comments. Just derive the SampleConfig
trait on your config types, create an example object and generate a configuration file using that.
Example:
```rust use sample_config::SampleConfig;
/// Example enum.
enum ExampleEnum { /// A. #[default] VariantA, }
/// General documentation isn't used.
struct ExampleConfig {
/// Some optional string.
string: Option
let instance = ExampleConfig::default(); let yamlfilestring = instance.generatesampleyaml(); std::fs::write("output.yaml", &yamlfilestring).unwrap(); std::fs::remove_file("output.yaml").unwrap() ```
Please take a look at the tests to see more complicated examples.
This projects uses a bunch of clippy lints for higher code quality and style.
Install cargo-lints
using cargo install --git https://github.com/FlixCoder/cargo-lints
. The lints are defined in lints.toml
and can be checked by running cargo lints clippy --all-targets --workspace
.