1 2 3 4 5 6 7 8 9 10 11 12 13
#[async_trait::async_trait] pub trait Handler where Self: 'static + Send + Sync, { async fn start(&mut self); fn launch(mut self: Box<Self>) { tokio::spawn(async move { self.start().await; }); } }