rsiot/components/cmp_http_server/
shared_state.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::sync::Arc;

use tokio::sync::Mutex;

use crate::{
    executor::CmpInOut,
    message::{MsgDataBound, ServiceBound},
};

use super::Config;

#[derive(Clone)]
pub struct SharedState<TMsg, TService>
where
    TMsg: MsgDataBound,
    TService: ServiceBound,
{
    pub msg_bus: CmpInOut<TMsg, TService>,
    pub config: Config<TMsg>,
    pub cmp_plc_input: String,
    pub cmp_plc_output: String,
    pub cmp_plc_static: String,
}

pub type TSharedState<TMsg, TService> = Arc<Mutex<SharedState<TMsg, TService>>>;