systemprompt-models 0.21.1

Foundation data models for systemprompt.io AI governance infrastructure. Shared DTOs, config, and domain types consumed by every layer of the MCP governance pipeline.
Documentation
//! Process-table row helpers shared by admin repositories.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.

pub fn filter_running_services<T, F, P>(services: Vec<T>, get_pid: F, is_running: P) -> Vec<T>
where
    F: Fn(&T) -> Option<i32>,
    P: Fn(u32) -> bool,
{
    services
        .into_iter()
        .filter(|s| {
            get_pid(s)
                .and_then(|pid| u32::try_from(pid).ok())
                .is_some_and(&is_running)
        })
        .collect()
}