def TraceDraw.result

bend-trace-context@0.2.0.0 · trace_context.bend:1099

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

1099# The trace ID of a finished trace ID draw, or why it failed. A draw that has
1100# not finished would report exhaustion; law trace_id_ends shows that the word
1101# budget of TraceId.generate_with makes that case unreachable.
1102def TraceDraw.result(step: TraceStep) -> Result<&2, &2, GenerationError, TraceId>:
1103  match step:
1104    case DrawnTraceId{id}:
1105      Done{id}
1106    case TraceFailed{error}:
1107      Fail{error}
1108    case NeedTraceWord{draw}:
1109      Fail{ExhaustedTraceId{}}

Uses (4)

Used by (2)