orion_conf 0.2.1

conf storage
Documentation

orion-conf

CI Coverage Status crates.io

Features / 特性

  • 默认不启用任何格式特性(default = []),请显式启用至少一个格式特性。
  • 单格式特性:yamltomljsonini(分别启用 serde_yaml/toml/serde_json/serde_ini)。
  • 组合特性:
    • formats = yaml + toml + json + ini
    • formats-minimal = toml + json
    • formats-web = json + yaml
  • 便捷别名:default-toml 等价启用 tomldefault-yaml 等价启用 yaml
  • full = 启用全部格式;core = 基础能力(不含任何格式)。

默认优先级(用于 Configable::from_conf/save_conf 的默认行为):yaml > toml > json > ini

启用方式示例

在你的 Cargo.toml

[dependencies]
orion-conf = { version = "0.2", features = ["yaml"] }

或使用命令行:

cargo build --features yaml
cargo test --all-features -- --test-threads=1

运行示例(examples)

  • 仅 JSON:cargo run --example json_feature_test --features json
  • YAML+JSON 优先级:cargo run --example feature_priority_test --features yaml,json
  • 全功能综合:cargo run --example comprehensive_test --features yaml,toml,json,ini