TraceContext.TraceId.from_bytes: def of bend-trace-context@0.2.0.0 Import: import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext Lines 886-898 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=886&end_line=898 import Base import bend-trace-context@0.2.0.0/src/digits.bend as Digits # Read a trace ID from exactly 16 bytes, most significant first. The cells # are read in order: a missing cell fails with UnexpectedEnd and a cell above # 255 with InvalidByte, at its offset counted in cells; a 17th cell fails with # TrailingInput whatever it holds, and 16 zero bytes with ZeroId. Like a # parsed ID, the result makes no randomness assertion, since bytes do not say # how the ID was made; only a caller whose own generator, known to be random, # made it adds one with TraceId.assert_random. Laws: trace_bytes_inverse, # bytes_unasserted, trace_bytes_short, trace_bytes_long, trace_bytes_above, # zero_bytes and trace_bytes_accepts. def TraceId.from_bytes(bytes: List<&2, U32>) -> Result<&2, &2, Error, TraceId>: do Result<&2, &2, Error, TraceId>: value : Digits.NonZero<32n> <- Parse.id_bytes(16n, bytes, TraceIdField{}) return TraceId{value, False{}} Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/src/digits.bend&name=NonZero https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Field https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=Parse.id_bytes https://jend.leeeet.dev/definition.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&name=TraceId