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§
sourcefn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
sourcefn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage
Object Safety§
This trait is not object safe.