Skip to main content

spawned_concurrency/
message.rs

1/// A message that can be sent to an actor.
2///
3/// Each message type defines its expected reply type via `Result`.
4/// The `#[protocol]` macro generates `Message` implementations automatically.
5/// For standalone messages without a protocol, implement this trait manually:
6///
7/// ```ignore
8/// struct GetCount;
9/// impl Message for GetCount {
10///     type Result = u64;
11/// }
12/// ```
13pub trait Message: Send + 'static {
14    type Result: Send + 'static;
15}