def hs.scan

bend-kit-http@0.38.4.0 · http.bend:1321

import bend-kit-http@0.38.4.0/http.bend as Http
import Base

1321# Each step ends the scan or passes one interim head, and at most 8 interim heads pass.
1322def hs.scan(fuel: Nat, +head: Bool, st: Hs) -> Hs:
1323  match fuel:
1324    case 0n:
1325      match st:
1326        case HsSeek{buf, from, k}:
1327          HsBad{}
1328        case HsWait{buf, k}:
1329          HsWait{buf, k}
1330        case HsBad{}:
1331          HsBad{}
1332        case HsRes{res, rb, rest}:
1333          HsRes{res, rb, rest}
1334    case 1n+f:
1335      hs.scan(f, head, hs.step(head, st))

Uses (4)

Used by (1)