rsiot/components/cmp_redis_client/
component.rs

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