def TraceState.parse_fields

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

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

2288# Parse repeated tracestate field values, in arrival order, as their
2289# comma-joined combination (W3C 3.3.2). The combined value, joining commas
2290# included, must fit the tracestate input budget; a larger one is refused with
2291# StateTooLarge before any member is read, without measuring the rest. Then:
2292# empty members are ignored, and so is optional whitespace before a member and
2293# after its value; every nonempty member must be a valid entry (InvalidEntry)
2294# and counts toward the 32 allowed (TooManyMembers); the first entry of each
2295# key is kept. An error discards the whole state; a valid traceparent stays
2296# valid (spec #1). W3C 3.3: parse tracestate only for a message whose
2297# traceparent was parsed.
2298# Laws: fields_join, over_budget, within_budgets, first_wins and the others of
2299# section 10 of LAWS.bend.
2300def TraceState.parse_fields(limits: Limits, +fields: List<&2, String>) -> Result<&2, &2, StateError, TraceState>:
2301  Scan.within(Utf8.left_fields(fields, Some{Limits.tracestate_input(limits)}), fields)

Uses (10)

Used by (3)