rsiot/components/cmp_linux_spi_master/
component.rs1use async_trait::async_trait;
2
3use crate::{
4 executor::{CmpResult, Component, IComponentProcess, MsgBusLinker},
5 message::MsgDataBound,
6};
7
8use super::{config::Config, fn_process::fn_process};
9
10pub const COMPONENT_NAME: &str = "cmp_linux_spi_master";
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(&self, config: Config<TMsg>, msgbus_linker: MsgBusLinker<TMsg>) -> CmpResult {
20 fn_process(config, msgbus_linker.init(COMPONENT_NAME)).await?;
21 Ok(())
22 }
23}
24
25pub type Cmp<TMsg> = Component<Config<TMsg>, TMsg>;