An idiomatic Elixir wrapper for gen_statem in OTP 19 (and above).
Elixir
313
83 commits
updated Jun 16, 2024
An idiomatic Elixir wrapper for gen_statem in OTP 20 (and above).
Full documentation is available here.
You can find the package on Hex here.
One important difference between gen_statem and this wrapper is that you
declare your callback mode as part of use GenStateMachine in this wrapper,
rather than returning it from callback_mode/0.
Other than that (and the usual automatically-defined default callbacks as a
result of use-ing GenStateMachine), this wrapper does not make any
functional alterations.
This wrapper also provides a OTP error translator for Logger, which is
automatically added when the :gen_state_machine application is started.
Optionally, you may add :gen_state_machine to :included_applications rather
than :applications as indicated below if you do not want the translator to be
added to Logger.
gen_state_machine to your list of dependencies in mix.exs:def deps do
[{:gen_state_machine, "~> 3.0"}]
end
gen_state_machine is added to your applications:def application do
[applications: [:gen_state_machine]]
end
I would like to give special thanks to @fishcakez and @michalmuskala, who both provided invaluable feedback on this library!
Elixir
100.0%
An idiomatic Elixir wrapper for gen_statem in OTP 19 (and above).
Elixir
313
83 commits
updated Jun 16, 2024
An idiomatic Elixir wrapper for gen_statem in OTP 20 (and above).
Full documentation is available here.
You can find the package on Hex here.
One important difference between gen_statem and this wrapper is that you
declare your callback mode as part of use GenStateMachine in this wrapper,
rather than returning it from callback_mode/0.
Other than that (and the usual automatically-defined default callbacks as a
result of use-ing GenStateMachine), this wrapper does not make any
functional alterations.
This wrapper also provides a OTP error translator for Logger, which is
automatically added when the :gen_state_machine application is started.
Optionally, you may add :gen_state_machine to :included_applications rather
than :applications as indicated below if you do not want the translator to be
added to Logger.
gen_state_machine to your list of dependencies in mix.exs:def deps do
[{:gen_state_machine, "~> 3.0"}]
end
gen_state_machine is added to your applications:def application do
[applications: [:gen_state_machine]]
end
I would like to give special thanks to @fishcakez and @michalmuskala, who both provided invaluable feedback on this library!
Elixir
100.0%