Explorar el Código

feat(tauri): impl Send for app::Builder, closes #7618 (#7619)

* feat(tauri): impl Send for app::Builder

* chore: add .changes/app-builder-send.md
yydcnjjw hace 2 años
padre
commit
8a6766173b
Se han modificado 2 ficheros con 7 adiciones y 2 borrados
  1. 5 0
      .changes/app-builder-send.md
  2. 2 2
      core/tauri/src/app.rs

+ 5 - 0
.changes/app-builder-send.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch:enhance
+---
+
+Ensure Builder is Send by requiring the menu closure to be Send.

+ 2 - 2
core/tauri/src/app.rs

@@ -997,7 +997,7 @@ pub struct Builder<R: Runtime> {
 
   /// A closure that returns the menu set to all windows.
   #[cfg(desktop)]
-  menu: Option<Box<dyn FnOnce(&AppHandle<R>) -> crate::Result<Menu<R>>>>,
+  menu: Option<Box<dyn FnOnce(&AppHandle<R>) -> crate::Result<Menu<R>> + Send>>,
 
   /// Enable macOS default menu creation.
   #[allow(unused)]
@@ -1295,7 +1295,7 @@ impl<R: Runtime> Builder<R> {
   /// ```
   #[must_use]
   #[cfg(desktop)]
-  pub fn menu<F: FnOnce(&AppHandle<R>) -> crate::Result<Menu<R>> + 'static>(
+  pub fn menu<F: FnOnce(&AppHandle<R>) -> crate::Result<Menu<R>> + Send + 'static>(
     mut self,
     f: F,
   ) -> Self {