def kind

bend-kit-llm@0.13.0.1 · sse.bend:104

import bend-kit-llm@0.13.0.1/sse.bend as Sse
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

104# The kind of the field whose n-byte name starts at s: 1 data, 2 event, 3 id, 4 retry, 0 any other.
105def kind(+n: U32, a: Array<U32>, +s: U32) -> Array<U32> & U32:
106  match n:
107    case 2:
108      kind.is(3, Bytes.at(a, "id", s))
109    case 4:
110      kind.is(1, Bytes.at(a, "data", s))
111    case 5:
112      kind.five(s, Bytes.at(a, "event", s))
113    case _:
114      (a, 0)

Uses (10)

Used by (1)