# derpscfg
A brief, incomplete, and mostly wrong derive implementation for [scfg].
A fork of [scfg-rs] with simple but powerful derive capabilities.
[scfg]: https://codeberg.org/emersion/scfg
[scfg-rs]: https://sr.ht/~cdv/scfg-rs/
## Example
```rust
use derpscfg::prelude::*;
#[derive(Debug, Derpscfg)]
pub struct Model {
#[scfg(param)]
pub name: String,
pub max_speed: String,
pub weight: String,
pub lines_served: Vec<String>,
}
#[derive(Debug, Derpscfg)]
pub struct Train {
#[scfg(param)]
pub name: String,
pub model: Vec<Model>,
}
#[derive(Debug, Derpscfg)]
pub struct ScfgDemo {
pub train: Train,
}
fn main() {
static SCFG_DOC: &str = r#"
train "Shinkansen" {
model "E5" {
max-speed 320km/h
weight 453.5t
lines-served "Tōhoku" "Hokkaido"
}
model "E7" {
max-speed 275km/h
weight 540t
lines-served "Hokuriku" "Jōetsu"
}
}
"#;
let demo = derpscfg::parse::<ScfgDemo>(SCFG_DOC).unwrap();
println!("{demo:?}");
}
```
## Documentation
More details can be found in the [documentation of the derive macro][doc]. The
crate also comes with [several examples][examples].
[doc]: https://docs.rs/derpscfg/latest/derpscfg/derive.Derpscfg.html
[examples]: https://git.sr.ht/~bitfehler/derpscfg/tree/master/item/examples
## Contributing
Please send patches to the [mailing list].
[mailing list]: mailto:~bitfehler/public-inbox@lists.sr.ht
## License
MIT OR Apache-2.0