MingaEditor.State.OperationProgress (Minga v0.1.0)

Copy Markdown View Source

Domain-authored completed-unit progress for an operation.

Summary

Functions

Builds progress when current is non-negative and does not exceed a positive wire-safe total.

Builds valid progress or raises for an impossible range.

Types

error()

@type error() :: :invalid_progress_range

t()

@type t() :: %MingaEditor.State.OperationProgress{
  current: non_neg_integer(),
  total: pos_integer()
}

Functions

new(current, total)

@spec new(integer(), integer()) :: {:ok, t()} | {:error, error()}

Builds progress when current is non-negative and does not exceed a positive wire-safe total.

new!(current, total)

@spec new!(integer(), integer()) :: t()

Builds valid progress or raises for an impossible range.