pub async fn current(sd: &Systemd) -> Result<Self> {
        let units = sd.list_units().await.context("while listing all units")?;
        let mut native_services = BTreeMap::new();
        for u in units {
            match u.active_state {
                ActiveState::Active | ActiveState::Reloading | ActiveState::Activating => {}
                _ => continue,
            }
            // if this parses to this json struct, then it's a metalos service,
            // otherwise just ignore it
            match serde_json::from_str::<UnitMetadata>(&u.description) {
                Ok(meta) => {
                    native_services.insert(meta.native_service, meta.version);
                }
                Err(_) => {}
            };
        }
        Ok(Self::new(native_services))
    }
/// Load the set of MetalOS native services that are currently running.
Load the set of MetalOS native services that are currently running.
Load the set of MetalOS native services that are currently running .
pub async fn current(sd: &Systemd) -> Result<Self> {
        let units = sd.list_units().await.context("while listing all units")?;
        let mut native_services = BTreeMap::new();
        for u in units {
            match u.active_state {
                ActiveState::Active | ActiveState::Reloading | ActiveState::Activating => {}
                _ => continue,
            }
            // if this parses to this json struct, then it's a metalos service,
            // otherwise just ignore it
            match serde_json::from_str::<UnitMetadata>(&u.description) {
                Ok(meta) => {
                    native_services.insert(meta.native_service, meta.version);
                }
                Err(_) => {}
            };
        }
        Ok(Self::new(native_services))
    }
pub async fn current ( sd : & Systemd ) -> Result < Self > { let units = sd . list_units ( ) . await . context ( " " ) ? ; let mut native_services = BTreeMap :: new ( ) ; for u in units { match u . active_state { ActiveState :: Active | ActiveState :: Reloading | ActiveState :: Activating => { } _ => continue , } // if this parses to this json struct, then it's a metalos service, // otherwise just ignore it match serde_json :: from_str :: < UnitMetadata > ( & u . description ) { Ok ( meta ) => { native_services . insert ( meta . native_service , meta . version ) ; } Err ( _ ) => { } } ; } Ok ( Self :: new ( native_services ) ) }
Load the set of MetalOS native services that are currently running.
Load the set of MetalOS native services that are currently running .
sd
&Systemd
sd
&Systemd