def utf8.decode.go
import bend-kit-encoding@0.5.0.0/encoding.bend as Encodingimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
131def utf8.decode.go(n: Nat, r: Array<U32> & U32, +i: U32, st: Utf8) -> String:
132 match n:
133 case 0n:
134 (a, v) = r
135 utf8.finish(st)
136 case 1n+p:
137 (a, +b) = r
138 utf8.decode.go(p, Bytes.peek(a, (i + 1 : U32)), (i + 1 : U32), utf8.step.st(st, b))