rsiot/components/cmp_http_server/routes/
plc_static.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use axum::extract;

use crate::message::*;

use super::super::{error::Error, shared_state::TSharedState};

/// Маршрут для получения всех сообщений
pub async fn plc_static<TMsg, TService>(
    extract::State(shared_state): extract::State<TSharedState<TMsg, TService>>,
) -> Result<String, Error>
where
    TMsg: MsgDataBound,
    TService: ServiceBound,
{
    let shared_state = shared_state.lock().await;
    let data = shared_state.cmp_plc_static.clone();
    Ok(data)
}