Module rs::actors

source ·
Expand description

Actors are parts of Squeekboard containing state independent from the main application state.

Because main application state is meant to be immutable, it cannot be referenced directly by pieces of logic interacting with the environment.

Such impure logic is split away (actor’s logic) and combined with relevant pieces of state (actor state), thus preserving the purity (and sometimes simplicity) of the main state.

Actors can communicate with the main state by sending it messages, and by receiving updates from it.

Modules

  • Contains actors with custom event loops, not based off of the event_loop module.
  • The popover is opened directly by the GTK surface, without bouncing click events off the main state. Then it must accurately show which layout has been selected. It can get the system layout directly from gsettings on open, but it cannot get the user-selected overlay, because it’s stored in state.

Traits

  • The implementing actor is able to receive and handle messages. Typically, it’s the sending end of the channel, whose other end is inside an event loop.