Expand description
§rwconfig — Read/Write Config with Dirty Tracking
A lightweight config file reader/writer that tracks modifications via get/set
and flushes all changes in one go with save(). Like getters/setters with dirty-tracking.
§Features
- Dot-path access — Use paths like
"server.port"or"a.b.c"for nested values - Dirty tracking — Every
set()marks the config dirty;save()writes only when needed - Multi-format — JSON, JSON5, JSONC, YAML, TOML; format is inferred from file extension
§Example
ⓘ
let mut cfg = RWConfig::from_file("config.json")?;
let port = cfg.get("server.port").and_then(|v| v.as_i64()).unwrap_or(8080);
cfg.set("server.port", json!(9090))?;
cfg.save()?;Structs§
- RWConfig
- Main config struct: load from file, get/set by path, save when dirty.
Config struct: loads from file, tracks changes, persists on
save().
Enums§
- Config
Format - Config format enum (Json, Yaml, Toml). Supported config format (detected from file extension).
- Error
- Unified error type (Io, Parse, Path variants). Errors that can occur when reading, writing, or modifying config.
- Value
- Re-export for convenience when working with config values. Represents any valid JSON value.