Skip to content

Commit fb7ee2c

Browse files
drop Sync req from setup and setup_with_config (#3471)
1 parent 123bedd commit fb7ee2c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changes/fix-drop-sync.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Callbacks passed to `tauri::plugin::Builder::setup` or `tauri::plugin::Builder::setup_with_config` are no longer required to implement `Sync`.

core/tauri/src/plugin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ pub trait Plugin<R: Runtime>: Send {
5454
fn extend_api(&mut self, invoke: Invoke<R>) {}
5555
}
5656

57-
type SetupHook<R> = dyn FnOnce(&AppHandle<R>) -> Result<()> + Send + Sync;
58-
type SetupWithConfigHook<R, T> = dyn FnOnce(&AppHandle<R>, T) -> Result<()> + Send + Sync;
57+
type SetupHook<R> = dyn FnOnce(&AppHandle<R>) -> Result<()> + Send;
58+
type SetupWithConfigHook<R, T> = dyn FnOnce(&AppHandle<R>, T) -> Result<()> + Send;
5959
type OnWebviewReady<R> = dyn FnMut(Window<R>) + Send + Sync;
6060
type OnEvent<R> = dyn FnMut(&AppHandle<R>, &RunEvent) + Send + Sync;
6161
type OnPageLoad<R> = dyn FnMut(Window<R>, PageLoadPayload) + Send + Sync;
@@ -251,7 +251,7 @@ impl<R: Runtime, C: DeserializeOwned> Builder<R, C> {
251251
#[must_use]
252252
pub fn setup<F>(mut self, setup: F) -> Self
253253
where
254-
F: FnOnce(&AppHandle<R>) -> Result<()> + Send + Sync + 'static,
254+
F: FnOnce(&AppHandle<R>) -> Result<()> + Send + 'static,
255255
{
256256
self.setup.replace(Box::new(setup));
257257
self
@@ -287,7 +287,7 @@ impl<R: Runtime, C: DeserializeOwned> Builder<R, C> {
287287
#[must_use]
288288
pub fn setup_with_config<F>(mut self, setup_with_config: F) -> Self
289289
where
290-
F: FnOnce(&AppHandle<R>, C) -> Result<()> + Send + Sync + 'static,
290+
F: FnOnce(&AppHandle<R>, C) -> Result<()> + Send + 'static,
291291
{
292292
self.setup_with_config.replace(Box::new(setup_with_config));
293293
self

0 commit comments

Comments
 (0)