use xtra::spawn::TokioGlobalSpawnExt; use xtra::Actor; use xtra_productivity::xtra_productivity; struct DummyActor; impl xtra::Actor for DummyActor {} #[derive(Clone)] struct DummyMessage; struct DummyMessageWithContext; // Dummy actor, xtra::Handler and xtra::Message impls generated by xtra_productivity #[xtra_productivity] impl DummyActor { pub fn handle_dummy_message(&mut self, message: DummyMessage) -> i32 { let _ = message.clone(); 0 } pub fn handle_dummy_message_with_context( &mut self, _message: DummyMessageWithContext, context: &mut xtra::Context, ) { let _ = context.address(); } } fn is_i32(_: i32) {} #[tokio::main] async fn main() { // Create dummy actor let dummy_actor = DummyActor.create(None).spawn_global(); // Send message to dummy actor let i32 = dummy_actor.send(DummyMessage).await.unwrap(); is_i32(i32); dummy_actor.send(DummyMessageWithContext).await.unwrap(); }