1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::fmt::Debug;
use serde::{Serialize, Deserialize};
use pid::Pid;
use correlation_id::CorrelationId;
use msg::Msg;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Envelope<T> {
pub to: Pid,
pub from: Pid,
pub msg: Msg<T>,
pub correlation_id: Option<CorrelationId>
}
impl<'de, T: Serialize + Deserialize<'de> + Debug + Clone> Envelope<T> {
pub fn new(to: Pid, from: Pid, msg: Msg<T>, c_id: Option<CorrelationId>) -> Envelope<T> {
Envelope {
to: to,
from: from,
msg: msg,
correlation_id: c_id
}
}
}