copernica_packets/
inter_link_packet.rs1use {
2 crate::{
3 link_id::{LinkId},
4 reply_to::{ReplyTo},
5 LinkPacket,
6 NarrowWaistPacket,
7 },
8 anyhow::{Result},
9};
10
11#[derive(Debug, Clone)]
12pub struct InterLinkPacket {
13 pub link_id: LinkId,
14 pub lp: LinkPacket,
15}
16
17impl InterLinkPacket {
18 pub fn new(link_id: LinkId, lp: LinkPacket) -> Self {
19 Self { link_id, lp }
20 }
21 pub fn link_id(&self) -> LinkId {
22 self.link_id.clone()
23 }
24 pub fn change_destination(&self, link_id: LinkId) -> Self {
25 Self { link_id, lp: self.lp.clone() }
26 }
27 pub fn reply_to(&self) -> Result<ReplyTo> {
28 self.link_id.reply_to()
29 }
30 pub fn narrow_waist(&self) -> NarrowWaistPacket {
31 self.lp.narrow_waist().clone()
32 }
33 pub fn link_packet(&self) -> LinkPacket {
34 self.lp.clone()
35 }
36}