diff --git a/.changes/channel-clone.md b/.changes/channel-clone.md new file mode 100644 index 000000000000..7a2a07afafad --- /dev/null +++ b/.changes/channel-clone.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch:bug" +--- + +Removed `TSend: Clone` requirement for `Channel` by implementing `Clone` manually instead of driving it. diff --git a/crates/tauri/src/ipc/channel.rs b/crates/tauri/src/ipc/channel.rs index 537662380bab..da46363230f9 100644 --- a/crates/tauri/src/ipc/channel.rs +++ b/crates/tauri/src/ipc/channel.rs @@ -35,7 +35,6 @@ static CHANNEL_DATA_COUNTER: AtomicU32 = AtomicU32::new(0); pub struct ChannelDataIpcQueue(pub(crate) Arc>>); /// An IPC channel. -#[derive(Clone)] pub struct Channel { id: u32, on_message: Arc crate::Result<()> + Send + Sync>, @@ -49,6 +48,16 @@ const _: () = { struct Channel(std::marker::PhantomData); }; +impl Clone for Channel { + fn clone(&self) -> Self { + Self { + id: self.id, + on_message: self.on_message.clone(), + phantom: Default::default(), + } + } +} + impl Serialize for Channel { fn serialize(&self, serializer: S) -> Result where