Mobus.Stepwise.Result (mobus_stepwise v0.2.0)

Copy Markdown View Source

Normalized outcome helpers for engine return values.

The engine returns one of three tuple shapes:

  • {:ok, runtime}
  • {:wait, runtime, wait_cfg}
  • {:error, reason, runtime}

These helpers destructure any of those shapes uniformly, so orchestration code never hand-parses tuples.

Summary

Functions

Returns true if the result is an error.

Returns the error reason, or nil.

Returns true if the result is ok.

Extracts the runtime from any engine result shape.

Returns the status atom: :ok, :wait, or :error.

Returns true if the result is a wait.

Returns the wait configuration, or nil.

Types

engine_result()

@type engine_result() ::
  {:ok, map()}
  | {:wait, map(), map()}
  | {:error, term(), map()}
  | {:error, term()}

Functions

error?(arg1)

@spec error?(engine_result()) :: boolean()

Returns true if the result is an error.

error_reason(arg1)

@spec error_reason(engine_result()) :: term() | nil

Returns the error reason, or nil.

ok?(arg1)

@spec ok?(engine_result()) :: boolean()

Returns true if the result is ok.

runtime(arg)

@spec runtime(engine_result()) :: map() | nil

Extracts the runtime from any engine result shape.

status(arg)

@spec status(engine_result()) :: :ok | :wait | :error

Returns the status atom: :ok, :wait, or :error.

wait?(arg1)

@spec wait?(engine_result()) :: boolean()

Returns true if the result is a wait.

wait_config(arg1)

@spec wait_config(engine_result()) :: term() | nil

Returns the wait configuration, or nil.