def utf8.scan
mylsm-lsm-store@0.6.0.1 · src/StorageBytes.bend:60
import mylsm-lsm-store@0.6.0.1/src/StorageBytes.bend as StorageBytes
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
60def utf8.scan(
61 remaining: Nat,
62 +offset: U32,
63 pair: Array<U32> & U32,
64 state: Utf8State
65) -> Result<&1, &1, U32 & String, String>:
66 match remaining:
67 case 0n:
68 match pair:
69 case (_, _):
70 utf8.scan.fin(state)
71 case 1n+p:
72 match pair:
73 case (buf, b):
74 utf8.scan(p, (offset + 1 : U32), Bytes.peek(buf, (offset + 1 : U32)), utf8.step(state, b))