mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-06-06 07:41:41 +00:00
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:
+13
-5
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user