config/
lib.rs

1//! [`Config`] organizes hierarchical or layered configurations for Rust applications.
2//!
3//! [`Config`] lets you set a set of [default parameters][ConfigBuilder::set_default] and then extend them via merging in
4//! configuration from a variety of sources:
5//!
6//!  - [Environment variables][Environment]
7//!  - [String literals][FileSourceString] in [well-known formats][FileFormat]
8//!  - Another [`Config`] instance
9//!  - [Files][FileSourceFile] in [well known formats][FileFormat] and custom ones defined with [`Format`] trait
10//!  - Manual, programmatic [overrides][ConfigBuilder::set_override]
11//!
12//! Additionally, [`Config`] supports:
13//!
14//!  - Live watching and re-reading of configuration files
15//!  - Deep access into the merged configuration via a path syntax
16//!  - Deserialization via `serde` of the configuration or any subset defined via a path
17//!
18//! # Example
19//!
20//! ```rust
21//! # #[cfg(feature = "toml")] {
22#![doc = include_str!("../examples/simple/main.rs")]
23//! # }
24//! ```
25//!
26//! See more [examples](https://github.com/mehcode/config-rs/tree/master/examples) for
27//! general usage information.
28
29#![cfg_attr(docsrs, feature(doc_auto_cfg))]
30#![warn(clippy::print_stderr)]
31#![warn(clippy::print_stdout)]
32
33pub mod builder;
34mod config;
35mod de;
36mod env;
37mod error;
38mod file;
39mod format;
40mod map;
41mod path;
42mod ser;
43mod source;
44mod value;
45
46// Re-export
47#[cfg(feature = "convert-case")]
48pub use convert_case::Case;
49
50pub use crate::builder::ConfigBuilder;
51pub use crate::config::Config;
52pub use crate::env::Environment;
53pub use crate::error::ConfigError;
54pub use crate::file::source::FileSource;
55pub use crate::file::{File, FileFormat, FileSourceFile, FileSourceString, FileStoredFormat};
56pub use crate::format::Format;
57pub use crate::map::Map;
58#[cfg(feature = "async")]
59pub use crate::source::AsyncSource;
60pub use crate::source::Source;
61pub use crate::value::{Value, ValueKind};