Skip to content

Commit 052c582

Browse files
authored
feat(core): implement Clone for PluginHandle (#6644)
1 parent d378081 commit 052c582

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changes/plugin-handle-clone.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Implement `Clone` for `plugin::PluginHandle`.

core/tauri/src/plugin.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,22 @@ type OnPageLoad<R> = dyn FnMut(Window<R>, PageLoadPayload) + Send;
7070
type OnDrop<R> = dyn FnOnce(AppHandle<R>) + Send;
7171

7272
/// A handle to a plugin.
73-
#[derive(Clone)]
73+
#[derive(Debug)]
7474
#[allow(dead_code)]
7575
pub struct PluginHandle<R: Runtime> {
7676
name: &'static str,
7777
handle: AppHandle<R>,
7878
}
7979

80+
impl<R: Runtime> Clone for PluginHandle<R> {
81+
fn clone(&self) -> Self {
82+
Self {
83+
name: self.name,
84+
handle: self.handle.clone(),
85+
}
86+
}
87+
}
88+
8089
impl<R: Runtime> PluginHandle<R> {
8190
/// Returns the application handle.
8291
pub fn app(&self) -> &AppHandle<R> {

0 commit comments

Comments
 (0)