orion_conf

Crates.ioorion_conf
lib.rsorion_conf
version0.3.0
created_at2025-08-26 02:35:19.053413+00
updated_at2025-09-20 02:05:18.670756+00
descriptionconf storage
homepage
repositoryhttps://github.com/galaxy-sec/orion-conf
max_upload_size
id1810432
size73,765
(fated-zuo)

documentation

README

orion-conf

CI Coverage Status crates.io

Lightweight, feature‑gated config IO for Rust. Enable only the formats you need.

Quick Start

use orion_conf::{ConfigIO, YamlIO};
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, PartialEq)]
struct AppCfg { name: String, value: i32 }

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // cargo run --features yaml
    let cfg = AppCfg { name: "demo".into(), value: 7 };
    let path = std::path::Path::new("app.yaml");

    cfg.save_conf(path)?;                 // delegates by feature priority (YAML > TOML > JSON > INI)
    let loaded = AppCfg::load_conf(path)?; // same priority for loading

    // Or call the format explicitly
    cfg.save_yaml(path)?;
    let _ = AppCfg::load_yaml(path)?;
    Ok(())
}

Features

  • Formats (opt‑in): yaml, toml, json, ini
  • Combined: formats (all), full (all)
  • Default features: empty

Key Traits (0.3+)

  • ConfigIO: unified read/write with feature‑based priority
  • YamlIO/TomlIO/JsonIO/IniIO: explicit format IO

Examples

  • JSON only: cargo run --example json_feature_test --features json
  • YAML+JSON priority: cargo run --example feature_priority_test --features yaml,json

Migration

  • See MIGRATION.md for 0.2.x → 0.3.0 changes and API replacements.
Commit count: 28

cargo fmt