crb_actor/
message.rs

1
2
3
4
5
6
7
8
9
10
use crate::Actor;
use anyhow::Error;
use async_trait::async_trait;

pub type Envelope<A> = Box<dyn MessageFor<A>>;

#[async_trait]
pub trait MessageFor<A: Actor + ?Sized>: Send + 'static {
    async fn handle(self: Box<Self>, actor: &mut A, ctx: &mut A::Context) -> Result<(), Error>;
}