rsiot/components/cmp_logger/
component.rs1use crate::{
2 executor::{Component, ComponentError, IComponentProcess, MsgBusLinker},
3 message::MsgDataBound,
4};
5use async_trait::async_trait;
6
7use super::{Config, fn_process::fn_process};
8
9pub const COMPONENT_NAME: &str = "cmp_logger";
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: 'static + MsgDataBound,
17{
18 async fn process(
19 &self,
20 config: Config<TMsg>,
21 msgbus_linker: MsgBusLinker<TMsg>,
22 ) -> Result<(), ComponentError> {
23 fn_process(config, msgbus_linker.init(COMPONENT_NAME)).await?;
24 Ok(())
25 }
26}
27
28pub type Cmp<TMsg> = Component<Config<TMsg>, TMsg>;