def TraceId.from_bytes
import bend-trace-context@0.2.0.0/trace_context.bend as TraceContextimport Base
import bend-trace-context@0.2.0.0/src/digits.bend as Digits
886# Read a trace ID from exactly 16 bytes, most significant first. The cells
887# are read in order: a missing cell fails with UnexpectedEnd and a cell above
888# 255 with InvalidByte, at its offset counted in cells; a 17th cell fails with
889# TrailingInput whatever it holds, and 16 zero bytes with ZeroId. Like a
890# parsed ID, the result makes no randomness assertion, since bytes do not say
891# how the ID was made; only a caller whose own generator, known to be random,
892# made it adds one with TraceId.assert_random. Laws: trace_bytes_inverse,
893# bytes_unasserted, trace_bytes_short, trace_bytes_long, trace_bytes_above,
894# zero_bytes and trace_bytes_accepts.
895def TraceId.from_bytes(bytes: List<&2, U32>) -> Result<&2, &2, Error, TraceId>:
896 do Result<&2, &2, Error, TraceId>:
897 value : Digits.NonZero<32n> <- Parse.id_bytes(16n, bytes, TraceIdField{})
898 return TraceId{value, False{}}
Uses (11)
Used by (0)
No other definition uses this definition.