Igor v0.3.0 Igor.Responder.GenServerHelper behaviour View Source
Helper for writing responders based on GenServer
.
This is similar to Igor.Responder.ModuleHelper
, but allows for the
responder to be in its own process.
To use this helper, the module must define a struct that has a :pid
field, which must store the process ID of the GenServer
. It is
recommended that it also provide a function that will start the server and
return a struct.
The module must also define an init/1
function as required by GenServer
.
This helper provides command
and listen
macros, like
Igor.Responder.ModuleHelper
, but with an extra argument at the end, which
is the current state of the GenServer
. The return value must the same as
what would be returned by a handle_cast/2
method for a GenServer
.
An example of a responder using this is Igor.Responder.Slap
.
Link to this section Summary
Link to this section Functions
Link to this section Callbacks
help(responder, cmdprefix)
View Sourcehelp(responder :: Igor.Responder.Proto.t(), cmdprefix :: String.t()) :: [ String.t() ]
help(responder, cmdprefix, cmd)
View Sourcehelp( responder :: Igor.Responder.Proto.t(), cmdprefix :: String.t(), cmd :: String.t() ) :: String.t() | nil