1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{lib::Box, Message, Result, Routed};
use async_trait::async_trait;
#[async_trait]
pub trait Worker: Send + 'static {
type Message: Message;
type Context: Send + 'static;
async fn initialize(&mut self, _context: &mut Self::Context) -> Result<()> {
Ok(())
}
async fn shutdown(&mut self, _context: &mut Self::Context) -> Result<()> {
Ok(())
}
async fn handle_message(
&mut self,
_context: &mut Self::Context,
_msg: Routed<Self::Message>,
) -> Result<()> {
Ok(())
}
}