Skip to content

Commit

Permalink
Add missing Serialize/Deserialize derives
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed Aug 20, 2024
1 parent 20adb08 commit ef3c822
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions communication/src/logging.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion communication/src/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,7 +22,7 @@ type ByteOrder = byteorder::BigEndian;
/// Framing data for each `Vec<u8>` 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,
Expand Down

0 comments on commit ef3c822

Please sign in to comment.