#![allow(unused_crate_dependencies)]
use std::net::Ipv4Addr;
use derpscfg::{Directive, prelude::*};
#[derive(Debug, Derpscfg)]
pub struct Listen {
pub address: Ipv4Addr,
pub port: u16,
}
#[derive(Debug, Derpscfg)]
pub struct Config {
pub listen: Listen,
pub headers: Directive,
}
#[derive(Debug, Derpscfg)]
pub struct Wrapper {
pub config: Config,
}
fn main() {
static SCFG_DOC: &str = r#"
config {
listen {
address 127.0.0.1
port 8080
}
headers param1 param2 {
X-Custom-Header "some value"
X-Other-Header "other value"
nesting {
is possible
}
}
}
"#;
let demo = derpscfg::parse::<Wrapper>(SCFG_DOC).unwrap();
println!("{demo:?}");
}