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