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