orion-conf
Features / 特性
- 默认不启用任何格式特性(
default = []),请显式启用至少一个格式特性。 - 单格式特性:
yaml、toml、json、ini(分别启用serde_yaml/toml/serde_json/serde_ini)。 - 组合特性:
formats=yaml+toml+json+iniformats-minimal=toml+jsonformats-web=json+yaml
- 便捷别名:
default-toml等价启用toml;default-yaml等价启用yaml。 full= 启用全部格式;core= 基础能力(不含任何格式)。
默认优先级(用于 Configable::from_conf/save_conf 的默认行为):yaml > toml > json > ini。
启用方式示例
在你的 Cargo.toml:
[]
= { = "0.2", = ["yaml"] }
或使用命令行:
运行示例(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