rsiot/components/cmp_esp_gpio/
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_esp_gpio";
12
13#[cfg_attr(not(feature = "single-thread"), async_trait)]
14#[cfg_attr(feature = "single-thread", async_trait(?Send))]
15impl<TMsg> IComponentProcess<Config<TMsg>, TMsg> for Component<Config<TMsg>, TMsg>
16where
17 TMsg: MsgDataBound + 'static,
18{
19 async fn process(
20 &self,
21 config: Config<TMsg>,
22 msgbus_linker: MsgBusLinker<TMsg>,
23 ) -> Result<(), ComponentError> {
24 fn_process(config, msgbus_linker.init(COMPONENT_NAME)).await?;
25 Ok(())
26 }
27}
28
29pub type Cmp<TMsg> = Component<Config<TMsg>, TMsg>;