rsiot/components/cmp_esp_http_server/
component.rs1use async_trait::async_trait;
2
3use crate::{
4 executor::{Component, ComponentError, IComponentProcess, MsgBusLinker},
5 message::MsgDataBound,
6};
7
8use super::{config::Config, fn_process::fn_process};
9
10pub const COMPONENT_NAME: &str = "cmp_http_server_esp";
11
12#[cfg_attr(not(feature = "single-thread"), async_trait)]
13#[cfg_attr(feature = "single-thread", async_trait(?Send))]
14impl<TMsg> IComponentProcess<Config<TMsg>, TMsg> for Component<Config<TMsg>, TMsg>
15where
16 TMsg: MsgDataBound + 'static,
17{
18 async fn process(
19 &self,
20 config: Config<TMsg>,
21 msgbus_linker: MsgBusLinker<TMsg>,
22 ) -> Result<(), ComponentError> {
23 fn_process(msgbus_linker.init(COMPONENT_NAME), config).await?;
24 Ok(())
25 }
26}
27
28pub type Cmp<TMsg> = Component<Config<TMsg>, TMsg>;