def pre.if

bend-kit-multipart@0.3.0.0 · multipart.bend:411

import bend-kit-multipart@0.3.0.0/multipart.bend as Multipart
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

411# Pre: the preamble is dropped. Keeping dlen - 1 bytes means a delimiter split across chunks is still found.
412# A 0/1/2 suffix kind as two flags, since only a parameter can be matched.
413def pre.if(delim: Bool, data: Bool, buf: Bytes.Bytes, +i: U32, +dlen: U32, out: List<&1, Item>) -> Step:
414  match delim:
415    case True{}:
416      More{After{}, drop(buf, (i + dlen : U32)), out}
417    case False{}:
418      match data:
419        case True{}:
420          More{Pre{}, drop(buf, (i + 1 : U32)), out}
421        case False{}:
422          Pause{Pre{}, drop(buf, i), out}

Uses (9)

Used by (1)