1
0
mirror of https://github.com/payden/libwsclient synced 2025-06-13 12:53:52 +00:00
payden_libwsclient/utils/config_parser.rs

12 lines
324 B
Rust
Raw Permalink Normal View History

2025-05-16 06:09:24 +00:00
use crate::config::Config;
use anyhow::Result;
use std::fs::File;
use std::io::Read;
pub fn parse_config(path: &str) -> Result<Config> {
let mut file = File::open(path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
let config: Config = toml::from_str(&contents)?;
Ok(config)
}