actor_module

Attribute Macro actor_module 

Source
#[actor_module]
Expand description

The actor_module attribute is used to mark a module that contains the actor definition. It will generate the necessary code to implement the actor pattern, that is:

  • a proxy object that implements all the methods that are marked with the message_handler attribute
  • a message enum that contains all the messages that the actor can receive
  • a run method for that is going to start the actor and return the proxy object
  • all the needed logic for the actor

It support following arguments as key-value pairs:

  • channels_size: the size of the messages and task sender channels. Default is 10.
  • events_chan_size: the size of the channel used to send events to the actor. Default is 10.