| 1 | # config-file |
| 2 | |
| 3 | [](https://docs.rs/config-file) |
| 4 | [](https://crates.io/crates/config-file) |
| 5 | |
| 6 | ## Read and parse configuration file automatically |
| 7 | |
| 8 | config-file reads your configuration files and parse them automatically using their extension. |
| 9 | |
| 10 | ## Features |
| 11 | |
| 12 | - toml is enabled by default |
| 13 | - json is optional |
| 14 | - xml is optional |
| 15 | - yaml is optional |
| 16 | |
| 17 | ## Examples |
| 18 | |
| 19 | ```rust |
| 20 | use config_file::FromConfigFile; |
| 21 | use serde::Deserialize; |
| 22 | |
| 23 | #[derive(Deserialize)] |
| 24 | struct Config { |
| 25 | host: String, |
| 26 | } |
| 27 | |
| 28 | let config = Config::from_config_file("/etc/myconfig.toml").unwrap(); |
| 29 | ``` |