pub fn parse_file<P: AsRef<Path>>(path: P) -> Result<Value>
Expand description
Parse configuration from a file, auto-detecting format from extension
Reads a configuration file from disk and automatically detects the format based on the file extension (.conf, .toml, .json, .noml).
§Arguments
path
- Path to the configuration file
§Returns
Returns a Value
containing the parsed configuration data.
§Examples
use config_lib::parse_file;
let config = parse_file("app.conf")?;
let port = config.get("server.port").unwrap().as_integer()?;