diff --git a/.changes/fix-drop-sync.md b/.changes/fix-drop-sync.md new file mode 100644 index 000000000..e468a8236 --- /dev/null +++ b/.changes/fix-drop-sync.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Callbacks passed to `tauri::plugin::Builder::setup` or `tauri::plugin::Builder::setup_with_config` are no longer required to implement `Sync`. diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index b980e73af..df0b0ed34 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -54,8 +54,8 @@ pub trait Plugin: Send { fn extend_api(&mut self, invoke: Invoke) {} } -type SetupHook = dyn FnOnce(&AppHandle) -> Result<()> + Send + Sync; -type SetupWithConfigHook = dyn FnOnce(&AppHandle, T) -> Result<()> + Send + Sync; +type SetupHook = dyn FnOnce(&AppHandle) -> Result<()> + Send; +type SetupWithConfigHook = dyn FnOnce(&AppHandle, T) -> Result<()> + Send; type OnWebviewReady = dyn FnMut(Window) + Send + Sync; type OnEvent = dyn FnMut(&AppHandle, &RunEvent) + Send + Sync; type OnPageLoad = dyn FnMut(Window, PageLoadPayload) + Send + Sync; @@ -251,7 +251,7 @@ impl Builder { #[must_use] pub fn setup(mut self, setup: F) -> Self where - F: FnOnce(&AppHandle) -> Result<()> + Send + Sync + 'static, + F: FnOnce(&AppHandle) -> Result<()> + Send + 'static, { self.setup.replace(Box::new(setup)); self @@ -287,7 +287,7 @@ impl Builder { #[must_use] pub fn setup_with_config(mut self, setup_with_config: F) -> Self where - F: FnOnce(&AppHandle, C) -> Result<()> + Send + Sync + 'static, + F: FnOnce(&AppHandle, C) -> Result<()> + Send + 'static, { self.setup_with_config.replace(Box::new(setup_with_config)); self