1234567891011121314151617181920 |
- use serde::Deserialize;
- pub fn parse_config(config_str: &str) -> Result<Config, toml::de::Error> {
- toml::from_str(config_str)
- }
- #[derive(Deserialize)]
- pub struct Config {
- pub default_questions: String,
- pub server_config: ServerConfig
- }
- #[derive(Deserialize)]
- pub struct ServerConfig {
- pub ip: String,
- pub port: Option<u16>,
- pub workers: Option<u32>
- }
|