Io.stdio.chunked: def of ezmcp@0.1.0.0 Import: import ezmcp@0.1.0.0/src/io.bend as Io Lines 332-351 of ezmcp@0.1.0.0/src/io.bend: https://jend.leeeet.dev/read.txt?path=ezmcp@0.1.0.0/src/io.bend&start_line=332&end_line=351 import Base import emerging-ezjson@1.2.0.0/src/value.bend as Value import ezmcp@0.1.0.0/src/rpc.bend as Rpc import ezmcp@0.1.0.0/src/server.bend as Server import ezmcp@0.1.0.0/src/line.bend as Line # after a read: an empty one is the end of stdin, and the bytes after the # last newline are the last message; any other is cut into lines def stdio.chunked( ~C: Data, ~run: C -> String -> Value.Json -> IO(Rpc.Out), ~srv: Server.Server, +ctx: C, rev: String, buf: List<&2, U32>, bytes: List<&2, U32>, again: List<&2, U32> -> String -> IO(Unit), empty: Bool ) -> IO(Unit): match empty: case True{}: IO.bind(String, Unit, stdio.lines(C, run, srv, ctx, [buf], rev), _r => IO.pure(Unit, Unit{})) case False{}: stdio.cut(C, run, srv, ctx, rev, again, Line.cut(List.append(&2, U32, buf, bytes))) Uses (15): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/value.bend&name=Json https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/io.bend&name=stdio.cut https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/io.bend&name=stdio.lines https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/line.bend&name=cut https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/rpc.bend&name=Out https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/server.bend&name=Server