rsiot/components/cmp_math/
component.rs

1use async_trait::async_trait;
2
3use crate::{
4    executor::{CmpInOut, CmpResult, Component, IComponentProcess},
5    message::{AuthPermissions, MsgDataBound},
6};
7
8use super::{config::Config, fn_process::fn_process, IntMsgBound};
9
10#[cfg_attr(not(feature = "single-thread"), async_trait)]
11#[cfg_attr(feature = "single-thread", async_trait(?Send))]
12impl<TMsg, TIntMsg> IComponentProcess<Config<TMsg, TIntMsg>, TMsg>
13    for Component<Config<TMsg, TIntMsg>, TMsg>
14where
15    TMsg: MsgDataBound + 'static,
16    TIntMsg: IntMsgBound + 'static,
17{
18    async fn process(&self, config: Config<TMsg, TIntMsg>, msg_bus: CmpInOut<TMsg>) -> CmpResult {
19        let in_out = msg_bus.clone_with_new_id("cmp_math", AuthPermissions::FullAccess);
20        fn_process(config, in_out).await?;
21        Ok(())
22    }
23}
24
25/// Компонент cmp_math
26pub type Cmp<TMsg, TIntMsg> = Component<Config<TMsg, TIntMsg>, TMsg>;