Module messages::handler[][src]

Expand description

In order for an Actor to be able to process messages, it should have logic associated with them.

For that matter, messages provides two traits:

  • Notifiable: handler for notifications, e.g. messages that do not require response.
  • Handler: handler that produces some data as a response to the sent message.

Note that Actor can implement both Notifiable and Handler traits in case the calculated data is important for some modules, but not so much for others.

Notifiable crate is generally more performant than Handler since it does not include overhead to return result back to the original message sender.

Traits

Coroutineruntime-tokio or runtime-async-std

Alternative to Handler that allows parallel message processing.

Handler

Handler is an extension trait for Actor that enables it to process messages and return results of the message processing.

Notifiable

Notifiable is an extension trait for Actor that enables it to process notifications.