rsiot/components/cmp_slint/
component.rs

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