rsiot_http_server/
component.rs

1use async_trait::async_trait;
2
3use rsiot_component_core::{CmpInOut, Component, ComponentError, IComponentProcess};
4use rsiot_messages_core::MsgDataBound;
5
6use crate::{config::ConfigAlias, fn_process::fn_process};
7
8#[cfg_attr(not(feature = "single-thread"), async_trait)]
9#[cfg_attr(feature = "single-thread", async_trait(?Send))]
10impl<TMsg> IComponentProcess<ConfigAlias<TMsg>, TMsg> for Component<ConfigAlias<TMsg>, TMsg>
11where
12    TMsg: MsgDataBound + 'static,
13{
14    async fn process(
15        &self,
16        config: ConfigAlias<TMsg>,
17        in_out: CmpInOut<TMsg>,
18    ) -> Result<(), ComponentError> {
19        let config = config.0;
20        fn_process(in_out, config).await
21    }
22}
23
24pub type Cmp<TMsg> = Component<ConfigAlias<TMsg>, TMsg>;