rsiot/components/cmp_slint/
config.rsuse std::sync::Arc;
use slint::{ComponentHandle, Weak};
use tokio::sync::{mpsc, Mutex, MutexGuard};
use crate::message::{Message, MsgDataBound};
pub struct Config<TMainWindow, TMsg>
where
Self: Sync,
TMsg: MsgDataBound,
TMainWindow: ComponentHandle,
{
pub instance: Arc<Mutex<Weak<TMainWindow>>>,
pub fn_input: fn(Message<TMsg>, MutexGuard<Weak<TMainWindow>>) -> (),
pub fn_output: fn(MutexGuard<Weak<TMainWindow>>, mpsc::Sender<Message<TMsg>>),
}
impl<TMainWindow, TMsg> Clone for Config<TMainWindow, TMsg>
where
TMsg: MsgDataBound,
TMainWindow: ComponentHandle,
{
fn clone(&self) -> Self {
Self {
instance: self.instance.clone(),
fn_input: self.fn_input,
fn_output: self.fn_output,
}
}
}