mcp_stdio_proxy/model/
app_state_model.rs

1use std::{ops::Deref, sync::Arc};
2
3use crate::AppConfig;
4
5#[derive(Debug, Clone)]
6pub struct AppState {
7    inner: Arc<AppStateInner>,
8}
9#[allow(unused)]
10#[derive(Debug)]
11pub struct AppStateInner {
12    pub addr: String,
13    pub config: AppConfig,
14}
15
16impl Deref for AppState {
17    type Target = AppStateInner;
18
19    fn deref(&self) -> &Self::Target {
20        &self.inner
21    }
22}
23
24impl AppState {
25    pub async fn new(config: AppConfig) -> Self {
26        Self {
27            inner: Arc::new(AppStateInner {
28                addr: format!("0.0.0.0:{}", config.server.port),
29                config,
30            }),
31        }
32    }
33}