derpscfg 0.8.0

A brief, incomplete, and mostly wrong derive implementation for scfg
Documentation
//! Example showing the use of various types.
#![allow(unused_crate_dependencies)]
use std::net::Ipv4Addr;

use derpscfg::prelude::*;

// Enum variants can be referred to in their actual (camel) case, all lowercase,
// or snake case.
#[derive(Debug, Derpscfg)]
pub enum ListenerType {
    Main,
    Metrics,
}

#[derive(Debug, Derpscfg)]
pub struct Limits {
    pub open_files: Option<u32>,
    pub connections: Option<u32>,
}

#[derive(Debug, Derpscfg)]
pub struct Listen {
    // For parameters, the field name does not matter
    #[scfg(param)]
    pub ltype: ListenerType,
    pub address: Ipv4Addr,
    pub port: u16,
}

#[derive(Debug, Derpscfg)]
pub struct Config {
    pub listen: Vec<Listen>,
    pub limits: Option<Limits>,
}

// If you want the document wrapped in a single node (like 'config{...}' in this
// example), create a wrapper struct.
#[derive(Debug, Derpscfg)]
pub struct Wrapper {
    pub config: Config,
}

fn main() {
    static SCFG_DOC: &str = r#"
config {
	listen metrics {
		address 127.0.0.1
		port 8080
	}

    listen main {
		address 192.168.1.123
		port 2222
	}

	limits {
		open-files 1024
	}
}
"#;

    let demo = derpscfg::parse::<Wrapper>(SCFG_DOC).unwrap();
    println!("{demo:?}");
}