Trait ractor::message::Message

source ·
pub trait Message: Any + Send + Sized + 'static {
    // Provided methods
    fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr> { ... }
    fn box_message(
        self,
        pid: &ActorId
    ) -> Result<BoxedMessage, BoxedDowncastErr> { ... }
}
Expand description

Message type for an actor. Generally an enum which muxes the various types of inner-messages the actor supports

§Example

pub enum MyMessage {
    /// Record the name to the actor state
    RecordName(String),
    /// Print the recorded name from the state to command line
    PrintName,
}

Provided Methods§

source

fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>

Convert a BoxedMessage to this concrete type

source

fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>

Convert this message to a BoxedMessage

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Any + Send + Sized + 'static> Message for T