def item

bend-kit-redis@0.3.0.0 · redis.bend:535

import bend-kit-redis@0.3.0.0/redis.bend as Redis
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

535# The type byte t, then the line from s until the CRLF at e.
536def item(+t: U32, +s: U32, +e: U32, b: Bytes.Bytes, stack: List<&1, Frame>) -> Bytes.Bytes & St:
537  match t:
538    case 43:
539      line.st(0, (e + 2 : U32), stack, Bytes.slice(b, s, (e - s : U32)))
540    case 45:
541      line.st(1, (e + 2 : U32), stack, Bytes.slice(b, s, (e - s : U32)))
542    case 44:
543      line.st(2, (e + 2 : U32), stack, Bytes.slice(b, s, (e - s : U32)))
544    case 40:
545      line.st(3, (e + 2 : U32), stack, Bytes.slice(b, s, (e - s : U32)))
546    case 58:
547      int.st((e + 2 : U32), stack, num(b, s, e))
548    case 95:
549      (b, null.st(U32.is_eq(s, e), (e + 2 : U32), stack))
550    case 35:
551      boolean.st((e + 2 : U32), stack, U32.is_eq(e, (s + 1 : U32)), byte(b, s))
552    case 36:
553      blob.st(0, (e + 2 : U32), stack, num(b, s, e))
554    case 33:
555      blob.st(1, (e + 2 : U32), stack, num(b, s, e))
556    case 61:
557      blob.st(2, (e + 2 : U32), stack, num(b, s, e))
558    case 42:
559      agg.st(0, (e + 2 : U32), stack, num(b, s, e))
560    case 37:
561      agg.st(1, (e + 2 : U32), stack, num(b, s, e))
562    case 126:
563      agg.st(2, (e + 2 : U32), stack, num(b, s, e))
564    case 124:
565      agg.st(3, (e + 2 : U32), stack, num(b, s, e))
566    case _:
567      agg.st(4, (e + 2 : U32), stack, num(b, s, e))

Uses (22)

Used by (1)