def Parse.trace

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

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

445# After the version: the trace ID, which must not be all zero, its "-" at
446# offset 35 and the parent ID from offset 36.
447def Parse.trace(parsed: Parsed<32n>) -> Result<&2, &2, Error, TraceParentV00>:
448  match parsed:
449    case Parsed{trace_digits, rest}:
450      do Result<&2, &2, Error, TraceParentV00>:
451        trace_id : Digits.NonZero<32n> <- Parse.nonzero(32n, trace_digits, TraceIdField{})
452        after : String <- Parse.separator(rest, 35n)
453        parent : Parsed<16n> <- Parse.digits(16n, after, 36n)
454        Parse.parent(trace_id, parent)

Uses (12)

Used by (1)