ados_protocol/units/
lookup.rs1use super::{UnitSpec, UNITS};
4
5pub fn find(name: &str) -> Option<&'static UnitSpec> {
8 let stem = name.strip_suffix(".service").unwrap_or(name);
9 UNITS.iter().find(|u| u.stem() == stem)
10}
11
12pub fn supervised() -> impl Iterator<Item = &'static UnitSpec> {
14 UNITS.iter().filter(|u| u.category.is_some())
15}
16
17pub fn net_daemon_owns_wifi(profile: &str) -> bool {
22 let profile = profile.replace('-', "_");
23 find("ados-uplink-router").is_some_and(|u| u.on_profile(&profile))
24}
25
26pub fn units_for_profile(profile: &str) -> impl Iterator<Item = &'static UnitSpec> + '_ {
28 UNITS.iter().filter(move |u| u.on_profile(profile))
29}