From bbce3ebee0119239a440e4f568a1777d404757ea Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Tue, 14 May 2024 11:44:09 +0200 Subject: [PATCH] Manually implement Clone for MessageStack This allows us to drop the M: Clone bound as it is not needed Signed-off-by: Lee Smet --- mycelium/src/message.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mycelium/src/message.rs b/mycelium/src/message.rs index a5b93c3..776bef1 100644 --- a/mycelium/src/message.rs +++ b/mycelium/src/message.rs @@ -85,11 +85,7 @@ pub type Checksum = [u8; MESSAGE_CHECKSUM_LENGTH]; /// Response type when pushing a message. pub type MessagePushResponse = (MessageId, Option>>); -#[derive(Clone)] -pub struct MessageStack -where - M: Clone, -{ +pub struct MessageStack { // The DataPlane is wrappen in a Mutex since it does not implement Sync. data_plane: Arc>>, inbox: Arc>, @@ -1055,6 +1051,18 @@ where } } +impl Clone for MessageStack { + fn clone(&self) -> Self { + Self { + data_plane: self.data_plane.clone(), + inbox: self.inbox.clone(), + outbox: self.outbox.clone(), + subscriber: self.subscriber.clone(), + reply_subscribers: self.reply_subscribers.clone(), + } + } +} + #[derive(Serialize)] #[serde(rename_all = "camelCase")] pub struct MessageInfo {