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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.