def Policy.apply

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

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

3482# A value under `policy`: itself with Lenient{}, and what `strict` makes of it
3483# with Strict{}.
3484def Policy.apply(policy: FailurePolicy, -A: Data, strict: A -> Result<&2, &2, GenerationError, A>, value: A) ->
3485  FailurePolicy.result(policy, A):
3486  match policy:
3487    case Lenient{}:
3488      value
3489    case Strict{}:
3490      strict(value)

Uses (4)

Used by (1)