use columnar::Columnar;
use serde::{Serialize, Deserialize};
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize, Columnar)]
pub struct CommunicationSetup {
pub sender: bool,
pub process: usize,
pub remote: Option<usize>,
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize, Columnar)]
pub enum CommunicationEvent {
Message(MessageEvent),
State(StateEvent),
Setup(CommunicationSetup)
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize, Columnar)]
pub struct MessageEvent {
pub is_send: bool,
pub header: crate::networking::MessageHeader,
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize, Columnar)]
pub struct StateEvent {
pub send: bool,
pub process: usize,
pub remote: usize,
pub start: bool,
}
impl From<MessageEvent> for CommunicationEvent {
fn from(v: MessageEvent) -> CommunicationEvent { CommunicationEvent::Message(v) }
}
impl From<StateEvent> for CommunicationEvent {
fn from(v: StateEvent) -> CommunicationEvent { CommunicationEvent::State(v) }
}