rsiot/components/cmp_surrealdb/
component.rs

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