diff --git a/src/integrations/tauri.rs b/src/integrations/tauri.rs index 1829d095..af8af8f4 100644 --- a/src/integrations/tauri.rs +++ b/src/integrations/tauri.rs @@ -29,7 +29,7 @@ struct Msg(serde_json::Value); struct WindowManager where TCtx: Send + Sync + 'static, - TCtxFn: Fn(Window) -> TCtx + Send + Sync + 'static, + TCtxFn: Fn(&Window) -> TCtx + Send + Sync + 'static, { executor: Executor, ctx_fn: TCtxFn, @@ -39,7 +39,7 @@ where impl WindowManager where TCtx: Clone + Send + Sync + 'static, - TCtxFn: Fn(Window) -> TCtx + Send + Sync + 'static, + TCtxFn: Fn(&Window) -> TCtx + Send + Sync + 'static, { pub fn new(ctx_fn: TCtxFn, router: Arc>) -> Arc { Arc::new(Self { @@ -68,7 +68,7 @@ where let (tx, rx) = mpsc::unbounded_channel(); R::spawn(ConnectionTask::::new( - (self.ctx_fn)(window.clone()), + (self.ctx_fn)(&window), self.executor.clone(), Socket { recv: rx, @@ -119,7 +119,7 @@ mod test { pub fn plugin( router: Arc>, - ctx_fn: impl Fn(Window) -> TCtx + Send + Sync + 'static, + ctx_fn: impl Fn(&Window) -> TCtx + Send + Sync + 'static, ) -> TauriPlugin where TCtx: Clone + Send + Sync + 'static,