pub trait Actor: Send + 'static {
// Required method
fn run(&mut self) -> impl Future<Output = Result<()>> + Send;
}Expand description
A minimal trait implemented by concrete actor types to run their mailbox.
async fn run() is intendet to be alive as long as the actor is alive,
processing actions from the mailbox sequentially.
Note: This is also the place to do any continuous background work your actor needs to perform.
The returned future should poll the mailbox and execute enqueued actions until the channel closes.
Required Methods§
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.