refactor(core): change setup closure type to FnOnce, closes #3061 (#3065)

This commit is contained in:
Lucas Fernandes Nogueira
2021-12-27 10:50:38 -03:00
committed by GitHub
parent 35588b2e04
commit 3f3599b9cc
3 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"tauri": "patch"
---
`Builder#setup` closure type changed from `Fn` to `FnOnce`.

View File

@@ -677,7 +677,7 @@ impl<R: Runtime> Builder<R> {
/// Defines the setup hook.
pub fn setup<F>(mut self, setup: F) -> Self
where
F: Fn(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send + 'static,
F: FnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send + 'static,
{
self.setup = Box::new(setup);
self

View File

@@ -16,7 +16,7 @@ use tauri_macros::default_runtime;
/// A closure that is run when the Tauri application is setting up.
pub type SetupHook<R> =
Box<dyn Fn(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send>;
Box<dyn FnOnce(&mut App<R>) -> Result<(), Box<dyn std::error::Error + Send>> + Send>;
/// A closure that is run everytime Tauri receives a message it doesn't explicitly handle.
pub type InvokeHandler<R> = dyn Fn(Invoke<R>) + Send + Sync + 'static;