def Read.prefix
import bend-trace-context@0.2.0.0/trace_context.bend as TraceContextimport Base
2874# A later version is read by its known prefix (W3C 3.2.4 and 4.1.2): its first
2875# 55 characters are read as version 00, which checks the trace ID, the parent
2876# ID, the flags and the dashes between them at their own offsets, and then the
2877# value must end or continue with a dash. A value that ends before its 55th
2878# character, with no invalid character before, fails with UnexpectedEnd.
2879def Read.prefix(+text: String) -> Result<&2, &2, Error, TraceParentV00>:
2880 do Result<&2, &2, Error, TraceParentV00>:
2881 known : TraceParentV00 <- TraceParentV00.parse("00" ++ String.drop(String.take(text, 55n), 2n))
2882 rest : Unit <- Read.extension(String.drop(text, 55n))
2883 return known