diff --git a/.changes/setup-fn-once.md b/.changes/setup-fn-once.md new file mode 100644 index 000000000..7f06a05ed --- /dev/null +++ b/.changes/setup-fn-once.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch" +--- + +`Builder#setup` closure type changed from `Fn` to `FnOnce`. diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 2e0913b83..1804cd47e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -677,7 +677,7 @@ impl Builder { /// Defines the setup hook. pub fn setup(mut self, setup: F) -> Self where - F: Fn(&mut App) -> Result<(), Box> + Send + 'static, + F: FnOnce(&mut App) -> Result<(), Box> + Send + 'static, { self.setup = Box::new(setup); self diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index dfe917a7d..3d9d199a2 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -16,7 +16,7 @@ use tauri_macros::default_runtime; /// A closure that is run when the Tauri application is setting up. pub type SetupHook = - Box) -> Result<(), Box> + Send>; + Box) -> Result<(), Box> + Send>; /// A closure that is run everytime Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) + Send + Sync + 'static;