rsiot/components/cmp_auth/
component.rs1use async_trait::async_trait;
2
3use crate::message::{AuthPermissions, MsgDataBound};
4
5use crate::executor::{CmpInOut, CmpResult, Component, ComponentError, IComponentProcess};
6
7use super::{fn_process::fn_process, Config};
8
9#[cfg_attr(not(feature = "single-thread"), async_trait)]
10#[cfg_attr(feature = "single-thread", async_trait(?Send))]
11impl<TMsg> IComponentProcess<Config, TMsg> for Component<Config, TMsg>
12where
13 TMsg: MsgDataBound + 'static,
14{
15 async fn process(&self, config: Config, in_out: CmpInOut<TMsg>) -> CmpResult {
16 let in_out = in_out.clone_with_new_id("cmp_auth", AuthPermissions::FullAccess);
17 fn_process(config, in_out)
18 .await
19 .map_err(|e| ComponentError::Execution(e.to_string()))
20 }
21}
22
23pub type Cmp<TMsg> = Component<Config, TMsg>;