A flexible and configurable Rust daemon library with lifecycle management, logging, callbacks, and optional async support. Works on Linux, macOS, and Windows.
//! Configuration management for the daemon library.
//!//! This module defines the `DaemonConfig` struct, which is used to load and manage
//! configuration settings for the daemon.
useserde::{Deserialize, Serialize};usestd::fs;/// Represents the configuration for the daemon.
#[derive(Debug, Serialize, Deserialize)]pubstructDaemonConfig{/// The log level (e.g., "debug", "info", "warn", "error").
publog_level: String,
/// Paths to binaries or resources to load.
pubbinary_paths:Vec<String>,
/// Whether async support is enabled.
pubasync_enabled:bool,
}implDaemonConfig{/// Loads the configuration from a file.
pubfnfrom_file(path:&str)->Result<Self, Box<dyn std::error::Error>>{let config_str =fs::read_to_string(path)?;let config: DaemonConfig =serde_json::from_str(&config_str)?;Ok(config)}}