Manually implement Clone for MessageStack

This allows us to drop the M: Clone bound as it is not needed

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2024-05-14 11:44:09 +02:00
parent e14ae464db
commit bbce3ebee0
+13 -5
View File
@@ -85,11 +85,7 @@ pub type Checksum = [u8; MESSAGE_CHECKSUM_LENGTH];
/// Response type when pushing a message.
pub type MessagePushResponse = (MessageId, Option<watch::Receiver<Option<ReceivedMessage>>>);
#[derive(Clone)]
pub struct MessageStack<M>
where
M: Clone,
{
pub struct MessageStack<M> {
// The DataPlane is wrappen in a Mutex since it does not implement Sync.
data_plane: Arc<Mutex<DataPlane<M>>>,
inbox: Arc<Mutex<MessageInbox>>,
@@ -1055,6 +1051,18 @@ where
}
}
impl<M> Clone for MessageStack<M> {
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 {