chrony-confile 0.1.0

A full-featured Rust library for parsing, editing, validating, and serializing chrony configuration files
Documentation
# chrony-confile

[![Crates.io](https://img.shields.io/crates/v/chrony-confile.svg)](https://crates.io/crates/chrony-confile)
[![Docs.rs](https://docs.rs/chrony-confile/badge.svg)](https://docs.rs/chrony-confile)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

A full-featured, production-grade Rust library for parsing, editing, validating,
and serializing [chrony](https://chrony-project.org/) configuration files.

## Features

- **Complete directive coverage** -- All 96 chrony directives supported
- **Lossless round-trip** -- Parse, modify, serialize; comments and formatting preserved
- **Type-safe API** -- Every value range-checked at compile time via newtypes
- **Strict and lenient modes** -- Fail-fast for main configs, tolerant for `.sources` files
- **Validation** -- Structural and semantic validation (no I/O required)
- **Builder pattern** -- Programmatic config generation with compile-time guarantees
- **Include/confdir expansion** -- Resolve `include` and `confdir` directives
- **100% safe Rust** -- `#![deny(unsafe_code)]`, zero `unsafe`
- **Minimal dependencies** -- Only `thiserror` required; `serde` is optional

## Installation

```toml
[dependencies]
chrony-confile = "0.1"
```

## Quick Start

```rust
use chrony_confile::prelude::*;

// Parse a configuration file
let config: ChronyConfig = r#"
    server ntp1.example.com iburst prefer
    server ntp2.example.com iburst
    pool pool.ntp.org maxsources 6
    driftfile /var/lib/chrony/drift
    allow 192.168.0.0/16
"#.parse()?;

// Iterate over directives
for server in config.find("server") {
    if let DirectiveKind::Server(s) = &server.kind {
        println!("Server: {} (iburst: {})", s.hostname, s.iburst);
    }
}

// Validate
let errors = config.validate();
assert!(errors.is_empty());

// Serialize back (comments, formatting preserved)
println!("{config}");

// Build configs programmatically
let directive = ServerBuilder::new("ntp.example.com")
    .iburst()
    .prefer()
    .minpoll(PollInterval::new(4)?)
    .build();
```

## MSRV

The minimum supported Rust version is 1.85 (edition 2024).

## License

MIT