use std::sync::Arc;
use std::time::SystemTime;
use static_assertions::assert_impl_all;
use crate::message::message_address::MessageAddress;
use crate::traits::ActonMessage;
#[derive(Debug, Clone)]
pub struct Envelope {
pub message: Arc<dyn ActonMessage + Send + Sync + 'static>,
pub timestamp: SystemTime,
pub reply_to: MessageAddress,
pub recipient: MessageAddress,
}
impl Envelope {
pub fn new(
message: Arc<dyn ActonMessage + Send + Sync + 'static>,
reply_to: MessageAddress,
recipient: MessageAddress,
) -> Self {
let timestamp = SystemTime::now();
Envelope {
message,
recipient,
reply_to,
timestamp,
}
}
}
assert_impl_all!(Envelope: Send);