diff --git a/src/runtime2/communication.rs b/src/runtime2/communication.rs index 0d2fd6149906e06134d68780b528a22d5a1101b9..7f84183fdc9885c463fad673a24142500abeceb7 100644 --- a/src/runtime2/communication.rs +++ b/src/runtime2/communication.rs @@ -29,7 +29,7 @@ pub enum PortKind { Getter, } -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PortState { Open, Blocked, @@ -189,6 +189,16 @@ impl Message { return None, } } + + pub(crate) fn modify_target_port(&mut self, port_id: PortId) { + match self { + Message::Data(v) => + v.data_header.target_port = port_id, + Message::Control(v) => + v.target_port_id = Some(port_id), + Message::Sync(_) => unreachable!(), // should never be called for this message type + } + } }