Std.ExitReason (Cure Standard Library v0.37.2)

View Source

Typed reasons understood by Cure's safe process APIs. Because is the deliberate raw-atom escape hatch for application- and OTP-specific reasons; callers do not need to abandon the typed API to use one.

Examples

use Std.ExitReason

from_atom(:normal)             # => Normal()
from_atom(:custom)             # => Because(:custom)
to_atom(Because(:custom))      # => :custom

Summary

Functions

Convert a raw BEAM exit atom into the typed ExitReason.

Convert a typed ExitReason back to the raw BEAM atom.

Types

enum ExitReason

 enum ExitReason
   Normal
   Kill
   Shutdown
   Because

Functions

from_atom(reason: Atom) -> ExitReason

 fn from_atom(reason: Atom) -> ExitReason

Convert a raw BEAM exit atom into the typed ExitReason.

:normal, :kill, and :shutdown map to their constructors; every other atom becomes Because(reason), the deliberate escape hatch for application- and OTP-specific reasons.

to_atom(reason: ExitReason) -> Atom

 fn to_atom(reason: ExitReason) -> Atom

Convert a typed ExitReason back to the raw BEAM atom.

The inverse of from_atom/1: Because(other) yields other unchanged, so a round trip through both functions is the identity for every reason.