pub struct Config {
pub profiles: HashMap<String, Profile>,
pub guard: GuardConfig,
pub rules: HashMap<String, AppRule>,
}Fields§
§profiles: HashMap<String, Profile>§guard: GuardConfigFreeze-guard daemon configuration. Skipped on serialize when at defaults so saving profiles doesn’t pollute config.yaml with a guard block.
rules: HashMap<String, AppRule>Persistent application limit rules, enforced continuously by rlm-guard. Keyed by rule name (defaults to the executable basename). Omitted from serialized output when empty.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_validated() -> Result<Self>
pub fn load_validated() -> Result<Self>
load() plus guard validation. rlm-guard refuses to start on Err.
Sourcepub fn get_profile(&self, name: &str) -> Option<Profile>
pub fn get_profile(&self, name: &str) -> Option<Profile>
Find a profile by name (includes built-in presets): an exact match wins, otherwise a case-insensitive match is used if exactly one profile name matches.
Sourcepub fn resolve_profile_name(&self, name: &str) -> Option<String>
pub fn resolve_profile_name(&self, name: &str) -> Option<String>
Resolve name to a real profile name: an exact match wins, otherwise
the single case-insensitive match, or None if there is no match or
more than one.
Sourcepub fn profile_names(&self) -> Vec<String>
pub fn profile_names(&self) -> Vec<String>
All profile names (user profiles plus built-in presets), sorted case-insensitively (ties broken by the name itself).
Sourcepub fn all_profiles(&self) -> HashMap<String, Profile>
pub fn all_profiles(&self) -> HashMap<String, Profile>
Get all profiles including built-in presets (user profiles override)
Sourcepub fn add_rule(&mut self, name: impl Into<String>, rule: AppRule)
pub fn add_rule(&mut self, name: impl Into<String>, rule: AppRule)
Add or replace a persistent application rule.
Sourcepub fn remove_rule(&mut self, name: &str) -> bool
pub fn remove_rule(&mut self, name: &str) -> bool
Remove a persistent rule by name. Returns true if a rule was removed.