TraceContext.TraceParent.read: def of bend-trace-context@0.2.0.0 Import: import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext Lines 2931-2952 of bend-trace-context@0.2.0.0/trace_context.bend: https://jend.leeeet.dev/read.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&start_line=2931&end_line=2952 import Base # Read one received traceparent value by the rules of a participant, and # return its known fields as a v00 value, flag byte included: # - a value over the traceparent input budget of `limits`, counted in UTF-8 # octets with its whitespace, is refused with TraceParentTooLarge; # - optional whitespace around the value is removed (RFC 9110, section 5.5); # - a value with a comma joins repeated fields and is refused with # RepeatedTraceParent, even when the comma is in fields of a later # version: no version defines a comma, and a host that joins repeated # fields separates them with one (RFC 9110, section 5.3); # - version 00 is read exactly by TraceParentV00.parse: 55 characters and # nothing after them; # - version ff is refused with ForbiddenVersion (W3C 3.2.2.1); # - versions 01 to fe are read by their known prefix: the fields of version # 00, followed by the end of the value or by a dash and fields that are # not read, whatever they hold other than a comma or a control character, # which is refused with ControlCharacter (W3C 3.2.4 and 4.1.2; RFC 9110, # section 5.5). # RemoteContext.from_traceparent then keeps the sampled and random-trace-id # flags. Laws: read_v00, read_v00_exact, read_future, read_ff, read_comma, # read_over_budget and read_within_budgets. def TraceParent.read(limits: Limits, +value: String) -> Result<&2, &2, TraceParentError, TraceParentV00>: Read.within(Utf8.left(value, Some{Limits.traceparent_input(limits)}), value) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Limits https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Limits.traceparent_input https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Read.within https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=TraceParentError https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=TraceParentV00 https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Utf8.left