subscriptions

Attribute Macro subscriptions 

Source
#[subscriptions]
Expand description

Allows you to register subscriptions to any global publishes of a message.

§Example

struct Cat;

#[process]
impl Cat {
   #[subscriptions]
   async fn subs(&self, evt: &EventBus<Self>) {
       evt.subscribe::<SayHi>().await;
   }

   #[handler]
   async fn hi(&mut self, msg: SayHi) -> Reply<(), ()> {
       println!("MEOW!");
       reply(())
   }
}

Learn more on The Speare Book