pub mod module_abstract;
#[cfg(feature = "default_module")]
pub mod file;
#[cfg(feature = "default_module")]
pub mod file_config;
#[cfg(feature = "default_module")]
pub mod command_line;
#[cfg(feature = "default_module")]
pub mod command_line_config;
#[cfg(feature = "hconfig")]
pub mod utils_hconfig {
use std::collections::HashMap;
use Hconfig::tinyjson::JsonValue;
pub fn setConfig_String(config: &mut HashMap<String, JsonValue>, key: &str, val: &mut String, condition: impl Fn(&str) -> bool)
{
if let Some(path) = config.get(key)
{
let tmp: String = path.clone().try_into().unwrap();
if (condition(tmp.as_str()))
{
*val = tmp;
return;
}
}
config.insert(key.to_string(), JsonValue::String(val.clone()));
}
pub fn setConfig_boolean(config: &mut HashMap<String, JsonValue>, key: &str, val: &mut bool)
{
if let Some(path) = config.get(key)
{
let tmp: &bool = path.get().unwrap();
*val = *tmp;
return;
}
config.insert(key.to_string(), JsonValue::Boolean(*val));
}
}