def TraceId.from_words

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

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

781# A trace ID from four words, read most significant first: the first word
782# gives the first eight digits. Like a parsed ID it makes no randomness
783# assertion; add one with TraceId.assert_random when the words are random. An
784# all-zero candidate is None (laws trace_words and words_unasserted).
785def TraceId.from_words(first: U32, second: U32, third: U32, fourth: U32) -> Maybe<&2, TraceId>:
786  TraceId.from_digits(Digits.NonZero.new(32n,
787    Digits.Digits.append(8n, 24n, Digits.Digits.of_u32(first),
788      Digits.Digits.append(8n, 16n, Digits.Digits.of_u32(second),
789        Digits.Digits.append(8n, 8n, Digits.Digits.of_u32(third), Digits.Digits.of_u32(fourth))))))

Uses (7)

Used by (1)