Skip to content

Commit 84895a9

Browse files
authored
fix(runtime): trait requirements (#3489)
1 parent b8e4d65 commit 84895a9

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-runtime": patch
3+
---
4+
5+
Fix requirements for `RuntimeHandle`, `ClipboardManager`, `GlobalShortcutHandle` and `TrayHandle`.

core/tauri-runtime/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub enum ActivationPolicy {
253253
}
254254

255255
/// A [`Send`] handle to the runtime.
256-
pub trait RuntimeHandle: Debug + Send + Sized + Clone + 'static {
256+
pub trait RuntimeHandle: Debug + Clone + Send + Sync + Sized + 'static {
257257
type Runtime: Runtime<Handle = Self>;
258258
/// Create a new webview window.
259259
fn create_window(
@@ -270,7 +270,7 @@ pub trait RuntimeHandle: Debug + Send + Sized + Clone + 'static {
270270
}
271271

272272
/// A global shortcut manager.
273-
pub trait GlobalShortcutManager: Debug {
273+
pub trait GlobalShortcutManager: Debug + Clone + Send + Sync {
274274
/// Whether the application has registered the given `accelerator`.
275275
fn is_registered(&self, accelerator: &str) -> crate::Result<bool>;
276276

@@ -289,7 +289,7 @@ pub trait GlobalShortcutManager: Debug {
289289
}
290290

291291
/// Clipboard manager.
292-
pub trait ClipboardManager: Debug {
292+
pub trait ClipboardManager: Debug + Clone + Send + Sync {
293293
/// Writes the text into the clipboard as plain text.
294294
fn write_text<T: Into<String>>(&mut self, text: T) -> Result<()>;
295295
/// Read the content in the clipboard as plain text.
@@ -303,12 +303,12 @@ pub trait Runtime: Sized + 'static {
303303
/// The runtime handle type.
304304
type Handle: RuntimeHandle<Runtime = Self>;
305305
/// The global shortcut manager type.
306-
type GlobalShortcutManager: GlobalShortcutManager + Clone + Send;
306+
type GlobalShortcutManager: GlobalShortcutManager;
307307
/// The clipboard manager type.
308-
type ClipboardManager: ClipboardManager + Clone + Send;
308+
type ClipboardManager: ClipboardManager;
309309
/// The tray handler type.
310310
#[cfg(feature = "system-tray")]
311-
type TrayHandler: menu::TrayHandle + Clone + Send;
311+
type TrayHandler: menu::TrayHandle;
312312

313313
/// Creates a new webview runtime. Must be used on the main thread.
314314
fn new() -> crate::Result<Self>;
@@ -353,7 +353,7 @@ pub trait Runtime: Sized + 'static {
353353
}
354354

355355
/// Webview dispatcher. A thread-safe handle to the webview API.
356-
pub trait Dispatch: Debug + Clone + Send + Sized + 'static {
356+
pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static {
357357
/// The runtime this [`Dispatch`] runs under.
358358
type Runtime: Runtime;
359359

core/tauri-runtime/src/menu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub enum MenuUpdate {
146146
SetNativeImage(NativeImage),
147147
}
148148

149-
pub trait TrayHandle: fmt::Debug {
149+
pub trait TrayHandle: fmt::Debug + Clone + Send + Sync {
150150
fn set_icon(&self, icon: crate::Icon) -> crate::Result<()>;
151151
fn set_menu(&self, menu: crate::menu::SystemTrayMenu) -> crate::Result<()>;
152152
fn update_item(&self, id: u16, update: MenuUpdate) -> crate::Result<()>;

0 commit comments

Comments
 (0)