def Digit.has_bit1

bend-trace-context@0.2.0.0 · src/hex.bend:179

import bend-trace-context@0.2.0.0/src/hex.bend as Hex
import Base

179# Whether bit 1 (value 2) of the digit is set. In the last digit of the flags
180# this is the random-trace-id flag (W3C 3.2.2.5.2).
181def Digit.has_bit1(digit: Digit) -> Bool:
182  match digit:
183    case H0{}:
184      False{}
185    case H1{}:
186      False{}
187    case H2{}:
188      True{}
189    case H3{}:
190      True{}
191    case H4{}:
192      False{}
193    case H5{}:
194      False{}
195    case H6{}:
196      True{}
197    case H7{}:
198      True{}
199    case H8{}:
200      False{}
201    case H9{}:
202      False{}
203    case Ha{}:
204      True{}
205    case Hb{}:
206      True{}
207    case Hc{}:
208      False{}
209    case Hd{}:
210      False{}
211    case He{}:
212      True{}
213    case Hf{}:
214      True{}

Uses (2)

Used by (4)