浏览代码

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 2 年之前
父节点
当前提交
8a6766173b
共有 2 个文件被更改,包括 7 次插入2 次删除
  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 {