seal_rs 0.3.2

Set of classic asynchronous primitives (Actors, Executors, Futures / Promises)
Documentation
//! Internal representation of a message
//!
//! Contains the message itself and elements of context.
use crate::actors::abstract_actor_ref::AbstractActorRef;
use crate::actors::abstract_actor_system::AbstractActorSystem;
use crate::common::tsafe::TSafe;
use std::any::Any;


pub struct Envelope {

    /// Boxed message
    pub message: Box<Any + Send + 'static>,

    /// Who send this message
    pub sender: Option<Box<AbstractActorRef + Send>>,

    /// Who must receive this message
    pub receiver: Box<AbstractActorRef + Send>,

    /// Link to the actor system
    pub system: TSafe<AbstractActorSystem + Send>
}

impl Envelope {
    pub fn new(message: Box<Any + Send + 'static>, sender: Option<Box<AbstractActorRef + Send>>, receiver: Box<AbstractActorRef + Send>, system: TSafe<AbstractActorSystem + Send>) -> Envelope {
        Envelope {
            message,
            sender,
            receiver,
            system
        }
    }
}