use super::{envelope::ActorEnvelope, id::ActorId};
#[derive(Debug, Clone)]
pub struct ActorMessage {
from: ActorId,
to: ActorId,
kind: String,
payload: serde_json::Value,
}
impl ActorMessage {
pub fn new(
from: impl Into<ActorId>,
to: impl Into<ActorId>,
kind: impl Into<String>,
payload: serde_json::Value,
) -> Self {
Self {
from: from.into(),
to: to.into(),
kind: kind.into(),
payload,
}
}
pub fn into_envelope(self) -> ActorEnvelope {
ActorEnvelope::new(self.from, self.to, self.kind, self.payload)
}
}