systemprompt-models 0.2.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
use super::context::RequestContext;
use std::sync::{Arc, Mutex};

pub type SharedRequestContext = Arc<Mutex<RequestContext>>;

impl From<RequestContext> for SharedRequestContext {
    fn from(context: RequestContext) -> Self {
        Self::new(Mutex::new(context))
    }
}

impl From<Arc<Mutex<Self>>> for RequestContext {
    fn from(shared: Arc<Mutex<Self>>) -> Self {
        let guard = shared
            .lock()
            .unwrap_or_else(std::sync::PoisonError::into_inner);
        guard.clone()
    }
}