From ef3c8229a182857aa9aad10b64e3688daf231540 Mon Sep 17 00:00:00 2001 From: Frank McSherry Date: Tue, 20 Aug 2024 15:07:02 -0400 Subject: [PATCH] Add missing Serialize/Deserialize derives --- communication/src/logging.rs | 10 ++++++---- communication/src/networking.rs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/communication/src/logging.rs b/communication/src/logging.rs index 7c94ea97f..7b0113182 100644 --- a/communication/src/logging.rs +++ b/communication/src/logging.rs @@ -1,7 +1,9 @@ //! Configuration and events for communication logging. +use serde::{Serialize, Deserialize}; + /// Configuration information about a communication thread. -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)] pub struct CommunicationSetup { /// True when this is a send thread (or the receive thread). pub sender: bool, @@ -12,7 +14,7 @@ pub struct CommunicationSetup { } /// Various communication events. -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)] pub enum CommunicationEvent { /// An observed message. Message(MessageEvent), @@ -21,7 +23,7 @@ pub enum CommunicationEvent { } /// An observed message. -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)] pub struct MessageEvent { /// true for send event, false for receive event pub is_send: bool, @@ -30,7 +32,7 @@ pub struct MessageEvent { } /// Starting or stopping communication threads. -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)] pub struct StateEvent { /// Is the thread a send (vs a recv) thread. pub send: bool, diff --git a/communication/src/networking.rs b/communication/src/networking.rs index 2fcca3dc3..433c2a911 100644 --- a/communication/src/networking.rs +++ b/communication/src/networking.rs @@ -9,6 +9,7 @@ use std::thread::sleep; use std::time::Duration; use byteorder::{ReadBytesExt, WriteBytesExt}; +use serde::{Deserialize, Serialize}; // This constant is sent along immediately after establishing a TCP stream, so // that it is easy to sniff out Timely traffic when it is multiplexed with @@ -21,7 +22,7 @@ type ByteOrder = byteorder::BigEndian; /// Framing data for each `Vec` transmission, indicating a typed channel, the source and /// destination workers, and the length in bytes. // *Warning*: Adding, removing and altering fields requires to adjust the implementation below! -#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)] pub struct MessageHeader { /// index of channel. pub channel: usize,